aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-12-06 21:00:24 +0100
committerGitHub <noreply@github.com>2016-12-06 21:00:24 +0100
commit558d5199b9c5020773872c81cb9428ba75f6f490 (patch)
treedd199d35b8136bd11dce837399658305ac8cba6d
parent4a1f963531f04427f625f58bda45723c6e69a87c (diff)
parent5aa0294cca8115ce9a9401f9587d07d7ee37b769 (diff)
downloadwallabag-558d5199b9c5020773872c81cb9428ba75f6f490.tar.gz
wallabag-558d5199b9c5020773872c81cb9428ba75f6f490.tar.zst
wallabag-558d5199b9c5020773872c81cb9428ba75f6f490.zip
Merge pull request #2680 from wallabag/taggingrule-255
Limit rule to 255
-rw-r--r--src/Wallabag/CoreBundle/Entity/TaggingRule.php1
-rw-r--r--tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php23
2 files changed, 24 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/TaggingRule.php b/src/Wallabag/CoreBundle/Entity/TaggingRule.php
index 28914cc1..72651b19 100644
--- a/src/Wallabag/CoreBundle/Entity/TaggingRule.php
+++ b/src/Wallabag/CoreBundle/Entity/TaggingRule.php
@@ -28,6 +28,7 @@ class TaggingRule
28 * @var string 28 * @var string
29 * 29 *
30 * @Assert\NotBlank() 30 * @Assert\NotBlank()
31 * @Assert\Length(max=255)
31 * @RulerZAssert\ValidRule( 32 * @RulerZAssert\ValidRule(
32 * allowed_variables={"title", "url", "isArchived", "isStared", "content", "language", "mimetype", "readingTime", "domainName"}, 33 * allowed_variables={"title", "url", "isArchived", "isStared", "content", "language", "mimetype", "readingTime", "domainName"},
33 * allowed_operators={">", "<", ">=", "<=", "=", "is", "!=", "and", "not", "or", "matches"} 34 * allowed_operators={">", "<", ">=", "<=", "=", "is", "!=", "and", "not", "or", "matches"}
diff --git a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
index 447feb4f..beb0598a 100644
--- a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
@@ -515,6 +515,29 @@ class ConfigControllerTest extends WallabagCoreTestCase
515 } 515 }
516 } 516 }
517 517
518 public function testTaggingRuleTooLong()
519 {
520 $this->logInAs('admin');
521 $client = $this->getClient();
522
523 $crawler = $client->request('GET', '/config');
524
525 $this->assertEquals(200, $client->getResponse()->getStatusCode());
526
527 $form = $crawler->filter('button[id=tagging_rule_save]')->form();
528
529 $crawler = $client->submit($form, [
530 'tagging_rule[rule]' => str_repeat('title', 60),
531 'tagging_rule[tags]' => 'cool tag',
532 ]);
533
534 $this->assertEquals(200, $client->getResponse()->getStatusCode());
535
536 $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
537
538 $this->assertContains('255 characters', $body[0]);
539 }
540
518 public function testDeletingTaggingRuleFromAnOtherUser() 541 public function testDeletingTaggingRuleFromAnOtherUser()
519 { 542 {
520 $this->logInAs('bob'); 543 $this->logInAs('bob');