aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-10-24 12:03:17 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-10-24 12:03:17 +0200
commit64a8781e453c40ff144d03405abe2dc1ccfacbe0 (patch)
tree311473a357e3dedd496e1417293eed9a2a116ad6 /tests
parent9313ea9d440e3f93a6bb2d8c0fb6717364cd27f5 (diff)
parentc64b4941d5222586a82d2c8d6a61969bb9cfe96b (diff)
downloadwallabag-64a8781e453c40ff144d03405abe2dc1ccfacbe0.tar.gz
wallabag-64a8781e453c40ff144d03405abe2dc1ccfacbe0.tar.zst
wallabag-64a8781e453c40ff144d03405abe2dc1ccfacbe0.zip
Merge remote-tracking branch 'origin/master' into 2.2
Diffstat (limited to 'tests')
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php40
-rw-r--r--tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php2
2 files changed, 40 insertions, 2 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');
diff --git a/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php b/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php
index 5e8ee41d..01a92ad2 100644
--- a/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php
+++ b/tests/Wallabag/ImportBundle/Consumer/RedisEntryConsumerTest.php
@@ -219,7 +219,7 @@ JSON;
219 219
220 $res = $consumer->manage($body); 220 $res = $consumer->manage($body);
221 221
222 $this->assertFalse($res); 222 $this->assertTrue($res);
223 $this->assertFalse($consumer->isStopJob($body)); 223 $this->assertFalse($consumer->isStopJob($body));
224 } 224 }
225} 225}