aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-10-20 22:49:46 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-10-20 22:49:46 +0200
commit2297d60f100effc1bf4300488a170a6bed3ae756 (patch)
tree69420ee3d6fb1a37f64ce54407f5cf9fc9e07dae /tests/Wallabag
parent7180aaed45dce62e40620a9e4b202526ebd6a3bb (diff)
downloadwallabag-2297d60f100effc1bf4300488a170a6bed3ae756.tar.gz
wallabag-2297d60f100effc1bf4300488a170a6bed3ae756.tar.zst
wallabag-2297d60f100effc1bf4300488a170a6bed3ae756.zip
If reload content failed, don’t update it
In case user wants a fresh version of the current one and the website isn’t available, don’t erase it with a boring message saying wallabag wasn’t able to refresh the content.
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');