diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-10-24 12:03:17 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-10-24 12:03:17 +0200 |
commit | 64a8781e453c40ff144d03405abe2dc1ccfacbe0 (patch) | |
tree | 311473a357e3dedd496e1417293eed9a2a116ad6 /tests/Wallabag/CoreBundle | |
parent | 9313ea9d440e3f93a6bb2d8c0fb6717364cd27f5 (diff) | |
parent | c64b4941d5222586a82d2c8d6a61969bb9cfe96b (diff) | |
download | wallabag-64a8781e453c40ff144d03405abe2dc1ccfacbe0.tar.gz wallabag-64a8781e453c40ff144d03405abe2dc1ccfacbe0.tar.zst wallabag-64a8781e453c40ff144d03405abe2dc1ccfacbe0.zip |
Merge remote-tracking branch 'origin/master' into 2.2
Diffstat (limited to 'tests/Wallabag/CoreBundle')
-rw-r--r-- | tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | 40 |
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'); |