aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Wallabag')
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php42
1 files changed, 41 insertions, 1 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index 9b03a519..c742c620 100644
--- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
@@ -359,11 +359,51 @@ class EntryControllerTest extends WallabagCoreTestCase
359 359
360 $content = $em 360 $content = $em
361 ->getRepository('WallabagCoreBundle:Entry') 361 ->getRepository('WallabagCoreBundle:Entry')
362 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); 362 ->find($content->getId());
363 363
364 $this->assertNotEmpty($content->getContent()); 364 $this->assertNotEmpty($content->getContent());
365 } 365 }
366 366
367 /**
368 * @depends testPostNewOk
369 *
370 * This test will require an internet connection.
371 */
372 public function testReloadWithFetchingFailed()
373 {
374 $this->logInAs('admin');
375 $client = $this->getClient();
376
377 $em = $client->getContainer()
378 ->get('doctrine.orm.entity_manager');
379
380 $content = $em
381 ->getRepository('WallabagCoreBundle:Entry')
382 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId());
383
384 // put a known failed url
385 $content->setUrl('http://0.0.0.0/failed.html');
386 $em->persist($content);
387 $em->flush();
388
389 $client->request('GET', '/reload/'.$content->getId());
390
391 $this->assertEquals(302, $client->getResponse()->getStatusCode());
392
393 // force EntityManager to clear previous entity
394 // otherwise, retrieve the same entity will retrieve change from the previous request :0
395 $em->clear();
396 $newContent = $em
397 ->getRepository('WallabagCoreBundle:Entry')
398 ->find($content->getId());
399
400 $newContent->setUrl($this->url);
401 $em->persist($newContent);
402 $em->flush();
403
404 $this->assertNotEquals($client->getContainer()->getParameter('wallabag_core.fetching_error_message'), $newContent->getContent());
405 }
406
367 public function testEdit() 407 public function testEdit()
368 { 408 {
369 $this->logInAs('admin'); 409 $this->logInAs('admin');