]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Merge remote-tracking branch 'origin/master' into 2.3
authorJeremy Benoist <jeremy.benoist@gmail.com>
Tue, 28 Mar 2017 12:07:42 +0000 (14:07 +0200)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Tue, 28 Mar 2017 12:07:42 +0000 (14:07 +0200)
src/Wallabag/ApiBundle/Controller/EntryRestController.php
tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php

index 2c2ec0c106ac1d72073649907f45a634ff7ad2ba..af5f760382bdbd729becb4c9dfb91cc7e4177649 100644 (file)
@@ -41,7 +41,7 @@ class EntryRestController extends WallabagRestController
                     ->getRepository('WallabagCoreBundle:Entry')
                     ->findByUrlAndUserId($url, $this->getUser()->getId());
 
-                $results[$url] = false === $res ? false : true;
+                $results[$url] = $res instanceof Entry ? $res->getId() : false;
             }
 
             $json = $this->get('serializer')->serialize($results, 'json');
@@ -60,7 +60,7 @@ class EntryRestController extends WallabagRestController
             ->getRepository('WallabagCoreBundle:Entry')
             ->findByUrlAndUserId($url, $this->getUser()->getId());
 
-        $exists = false === $res ? false : true;
+        $exists = $res instanceof Entry ? $res->getId() : false;
 
         $json = $this->get('serializer')->serialize(['exists' => $exists], 'json');
 
index 409a82914680f8618139ced4632491fd61f34dc2..dc5160c7a0badebea65f41f951db0ce7f8326b6d 100644 (file)
@@ -642,7 +642,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
 
         $content = json_decode($this->client->getResponse()->getContent(), true);
 
-        $this->assertEquals(true, $content['exists']);
+        $this->assertEquals(2, $content['exists']);
     }
 
     public function testGetEntriesExistsWithManyUrls()
@@ -657,7 +657,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
 
         $this->assertArrayHasKey($url1, $content);
         $this->assertArrayHasKey($url2, $content);
-        $this->assertEquals(true, $content[$url1]);
+        $this->assertEquals(2, $content[$url1]);
         $this->assertEquals(false, $content[$url2]);
     }