X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FWallabag%2FCoreBundle%2FController%2FEntryControllerTest.php;h=051136503969722f78b7720ab40cc90890efb2b9;hb=816c0940d142f8ec69bdd3f302c9751033cce7e2;hp=9b03a5193d1c7b8edb6d660f0cb021336061f663;hpb=ac8cf632bb3a225c1b69d16e714ff60a2e988c89;p=github%2Fwallabag%2Fwallabag.git diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 9b03a519..05113650 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php @@ -359,11 +359,49 @@ class EntryControllerTest extends WallabagCoreTestCase $content = $em ->getRepository('WallabagCoreBundle:Entry') - ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); + ->find($content->getId()); $this->assertNotEmpty($content->getContent()); } + /** + * @depends testPostNewOk + */ + public function testReloadWithFetchingFailed() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $em = $client->getContainer() + ->get('doctrine.orm.entity_manager'); + + $content = $em + ->getRepository('WallabagCoreBundle:Entry') + ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); + + // put a known failed url + $content->setUrl('http://0.0.0.0/failed.html'); + $em->persist($content); + $em->flush(); + + $client->request('GET', '/reload/'.$content->getId()); + + $this->assertEquals(302, $client->getResponse()->getStatusCode()); + + // force EntityManager to clear previous entity + // otherwise, retrieve the same entity will retrieve change from the previous request :0 + $em->clear(); + $newContent = $em + ->getRepository('WallabagCoreBundle:Entry') + ->find($content->getId()); + + $newContent->setUrl($this->url); + $em->persist($newContent); + $em->flush(); + + $this->assertNotEquals($client->getContainer()->getParameter('wallabag_core.fetching_error_message'), $newContent->getContent()); + } + public function testEdit() { $this->logInAs('admin');