Fix hazardous bug with Postgres

Instead of retrieving a random annotation, sort them to be sure they are all the same no matter the database used
This commit is contained in:
Jeremy Benoist 2016-03-12 10:45:14 +01:00
parent 09d8bb6fa2
commit b95ffda2a1
2 changed files with 2 additions and 1 deletions

View file

@ -101,6 +101,7 @@ class AnnotationRepository extends EntityRepository
return $this->createQueryBuilder('a')
->leftJoin('a.user', 'u')
->where('u.username = :username')->setParameter('username', $username)
->orderBy('a.id', 'DESC')
->setMaxResults(1)
->getQuery()
->getSingleResult();

View file

@ -81,7 +81,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
$this->assertEquals('Big boss', $content['user']);
$this->assertEquals('v1.0', $content['annotator_schema_version']);
$this->assertEquals('a modified annotation', $content['text']);
$this->assertEquals('content', $content['quote']);
$this->assertEquals('my quote', $content['quote']);
$annotationUpdated = $this->client->getContainer()
->get('doctrine.orm.entity_manager')