aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag
diff options
context:
space:
mode:
authorNicolas Lœuillet <nicolas@loeuillet.org>2016-10-21 15:12:29 +0200
committerGitHub <noreply@github.com>2016-10-21 15:12:29 +0200
commit49dee2d2de63af36248e92ce740da2692358280e (patch)
tree01649e5e6fcfeadeb61cc56408a03658be85a69a /tests/Wallabag
parent7180aaed45dce62e40620a9e4b202526ebd6a3bb (diff)
parentf6798f69c3f3d6f4f8295f8168785ade6f1f125a (diff)
downloadwallabag-49dee2d2de63af36248e92ce740da2692358280e.tar.gz
wallabag-49dee2d2de63af36248e92ce740da2692358280e.tar.zst
wallabag-49dee2d2de63af36248e92ce740da2692358280e.zip
Merge pull request #2482 from wallabag/avoid-bad-refresh
If reload content failed, don’t update it
Diffstat (limited to 'tests/Wallabag')
-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');