]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Fix hazardous bug with Postgres 1775/head
authorJeremy Benoist <jeremy.benoist@gmail.com>
Sat, 12 Mar 2016 09:45:14 +0000 (10:45 +0100)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Sat, 12 Mar 2016 09:45:14 +0000 (10:45 +0100)
Instead of retrieving a random annotation, sort them to be sure they are all the same no matter the database used

src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php
src/Wallabag/AnnotationBundle/Tests/Controller/AnnotationControllerTest.php

index 7f35373f5b3853f03c5a52e7b3d71d9d1b32a8ba..5f7da70ecfa4cb1d375fdbc94f68d9a019c2c4ce 100644 (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();
index 7a877f98317a453dcb6fb4b0d13e7cd183ab448a..e972c2deb22b8c0bb310757f05b04b0ee9bc7f64 100644 (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')