aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
diff options
context:
space:
mode:
authorKévin Gomez <contact@kevingomez.fr>2015-10-31 16:21:56 +0100
committerKévin Gomez <contact@kevingomez.fr>2015-11-11 16:27:19 +0100
commit8a99c7a86b138faee5dc92ab6ecbd281dbd19451 (patch)
treef854f9738baee16276c9e468a3169c563b015c1b /src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
parent9b88658c047514a75bc9a9e3578cbeba32c5c5d7 (diff)
downloadwallabag-8a99c7a86b138faee5dc92ab6ecbd281dbd19451.tar.gz
wallabag-8a99c7a86b138faee5dc92ab6ecbd281dbd19451.tar.zst
wallabag-8a99c7a86b138faee5dc92ab6ecbd281dbd19451.zip
Add a few functional tests for the tagging rules creation form
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php')
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
index 7085151a..4eb67ffd 100644
--- a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
@@ -479,4 +479,59 @@ class ConfigControllerTest extends WallabagCoreTestCase
479 $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text'))); 479 $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text')));
480 $this->assertContains($expectedMessage, $alert[0]); 480 $this->assertContains($expectedMessage, $alert[0]);
481 } 481 }
482
483 public function testTaggingRuleCreation()
484 {
485 $this->logInAs('admin');
486 $client = $this->getClient();
487
488 $crawler = $client->request('GET', '/config');
489
490 $this->assertTrue($client->getResponse()->isSuccessful());
491
492 $form = $crawler->filter('button[id=tagging_rule_save]')->form();
493
494 $data = array(
495 'tagging_rule[rule]' => 'readingTime <= 3',
496 'tagging_rule[tags]' => 'short reading',
497 );
498
499 $client->submit($form, $data);
500
501 $this->assertEquals(302, $client->getResponse()->getStatusCode());
502
503 $crawler = $client->followRedirect();
504
505 $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text')));
506 $this->assertContains('Tagging rules updated', $alert[0]);
507
508 $deleteLink = $crawler->filter('.delete')->eq(0)->link();
509
510 $crawler = $client->click($deleteLink);
511 $this->assertEquals(302, $client->getResponse()->getStatusCode());
512
513 $crawler = $client->followRedirect();
514 $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text')));
515 $this->assertContains('Tagging rule deleted', $alert[0]);
516 }
517
518 public function dataForTaggingRuleFailed()
519 {
520 return array(
521 array(
522 array(
523 'rss_config[rule]' => 'unknownVar <= 3',
524 'rss_config[tags]' => 'cool tag',
525 ),
526 'The variable « unknownVar » does not exist.',
527 ),
528 array(
529 array(
530 'rss_config[rule]' => 'length(domainName) <= 42',
531 'rss_config[tags]' => 'cool tag',
532 ),
533 'The operator « length » does not exist.',
534 ),
535 );
536 }
482} 537}