]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
Return an explicit error if reload fail
[github/wallabag/wallabag.git] / tests / Wallabag / ApiBundle / Controller / EntryRestControllerTest.php
index 3c8b7980001175f5c434519ea70b8928a955a035..432ce7d8907222611a7d3de6e9a9f9ae3189ea6a 100644 (file)
@@ -681,17 +681,20 @@ class EntryRestControllerTest extends WallabagApiTestCase
 
     public function testReloadEntryErrorWhileFetching()
     {
-        $entry = $this->client->getContainer()
-            ->get('doctrine.orm.entity_manager')
+        $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager')
             ->getRepository('WallabagCoreBundle:Entry')
-            ->findOneBy(['user' => 1, 'isArchived' => false]);
+            ->findByUrlAndUserId('http://0.0.0.0/entry4', 1);
 
         if (!$entry) {
             $this->markTestSkipped('No content found in db.');
         }
 
         $this->client->request('PATCH', '/api/entries/'.$entry->getId().'/reload.json');
-        $this->assertEquals(304, $this->client->getResponse()->getStatusCode());
+        $this->assertEquals(400, $this->client->getResponse()->getStatusCode());
+
+        $this->assertContains('Error while trying to extract content', $this->client->getResponse()->getContent());
+
+        $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type'));
     }
 
     public function testReloadEntry()