aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-03-11 09:42:08 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-03-20 21:12:22 +0100
commit4f9cf232f8d4d750d39aca83406b8a6d5e17a6c9 (patch)
treea8ee572196670730c593bc2781fad82ee7bce6d6 /src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
parent0d42217e4e8210dd2cf86f35ba9662ca02c8a2dc (diff)
downloadwallabag-4f9cf232f8d4d750d39aca83406b8a6d5e17a6c9.tar.gz
wallabag-4f9cf232f8d4d750d39aca83406b8a6d5e17a6c9.tar.zst
wallabag-4f9cf232f8d4d750d39aca83406b8a6d5e17a6c9.zip
Improve test failure readability
If the response content isn't the one expected, instead of checking into the whole DOM (with node tag, etc ..) we only check the text. So if it fails, phpunit will display only the text, not all node tag. It'll be easier to read.
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php')
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
index bf455f32..884e740e 100644
--- a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
@@ -418,11 +418,6 @@ class ConfigControllerTest extends WallabagCoreTestCase
418 418
419 $crawler = $client->request('GET', '/config'); 419 $crawler = $client->request('GET', '/config');
420 420
421 if (500 == $client->getResponse()->getStatusCode()) {
422 var_export($client->getResponse()->getContent());
423 die();
424 }
425
426 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 421 $this->assertEquals(200, $client->getResponse()->getStatusCode());
427 422
428 $form = $crawler->filter('button[id=rss_config_save]')->form(); 423 $form = $crawler->filter('button[id=rss_config_save]')->form();
@@ -556,12 +551,14 @@ class ConfigControllerTest extends WallabagCoreTestCase
556 551
557 $form = $crawler->filter('button[id=tagging_rule_save]')->form(); 552 $form = $crawler->filter('button[id=tagging_rule_save]')->form();
558 553
559 $client->submit($form, $data); 554 $crawler = $client->submit($form, $data);
560 555
561 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 556 $this->assertEquals(200, $client->getResponse()->getStatusCode());
562 557
558 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text')));
559
563 foreach ($messages as $message) { 560 foreach ($messages as $message) {
564 $this->assertContains($message, $client->getResponse()->getContent()); 561 $this->assertContains($message, $body[0]);
565 } 562 }
566 } 563 }
567 564
@@ -574,9 +571,11 @@ class ConfigControllerTest extends WallabagCoreTestCase
574 ->getRepository('WallabagCoreBundle:TaggingRule') 571 ->getRepository('WallabagCoreBundle:TaggingRule')
575 ->findAll()[0]; 572 ->findAll()[0];
576 573
577 $client->request('GET', '/tagging-rule/delete/'.$rule->getId()); 574 $crawler = $client->request('GET', '/tagging-rule/delete/'.$rule->getId());
575
578 $this->assertEquals(403, $client->getResponse()->getStatusCode()); 576 $this->assertEquals(403, $client->getResponse()->getStatusCode());
579 $this->assertContains('You can not access this tagging ryle', $client->getResponse()->getContent()); 577 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text')));
578 $this->assertContains('You can not access this tagging rule', $body[0]);
580 } 579 }
581 580
582 public function testDemoMode() 581 public function testDemoMode()