aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php40
1 files changed, 39 insertions, 1 deletions
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
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 public function testReloadWithFetchingFailed()
371 {
372 $this->logInAs('admin');
373 $client = $this->getClient();
374
375 $em = $client->getContainer()
376 ->get('doctrine.orm.entity_manager');
377
378 $content = $em
379 ->getRepository('WallabagCoreBundle:Entry')
380 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId());
381
382 // put a known failed url
383 $content->setUrl('http://0.0.0.0/failed.html');
384 $em->persist($content);
385 $em->flush();
386
387 $client->request('GET', '/reload/'.$content->getId());
388
389 $this->assertEquals(302, $client->getResponse()->getStatusCode());
390
391 // force EntityManager to clear previous entity
392 // otherwise, retrieve the same entity will retrieve change from the previous request :0
393 $em->clear();
394 $newContent = $em
395 ->getRepository('WallabagCoreBundle:Entry')
396 ->find($content->getId());
397
398 $newContent->setUrl($this->url);
399 $em->persist($newContent);
400 $em->flush();
401
402 $this->assertNotEquals($client->getContainer()->getParameter('wallabag_core.fetching_error_message'), $newContent->getContent());
403 }
404
367 public function testEdit() 405 public function testEdit()
368 { 406 {
369 $this->logInAs('admin'); 407 $this->logInAs('admin');