mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-26 19:11:07 +00:00
Merge pull request #2680 from wallabag/taggingrule-255
Limit rule to 255
This commit is contained in:
commit
558d5199b9
2 changed files with 24 additions and 0 deletions
|
@ -28,6 +28,7 @@ class TaggingRule
|
|||
* @var string
|
||||
*
|
||||
* @Assert\NotBlank()
|
||||
* @Assert\Length(max=255)
|
||||
* @RulerZAssert\ValidRule(
|
||||
* allowed_variables={"title", "url", "isArchived", "isStared", "content", "language", "mimetype", "readingTime", "domainName"},
|
||||
* allowed_operators={">", "<", ">=", "<=", "=", "is", "!=", "and", "not", "or", "matches"}
|
||||
|
|
|
@ -515,6 +515,29 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
|||
}
|
||||
}
|
||||
|
||||
public function testTaggingRuleTooLong()
|
||||
{
|
||||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$crawler = $client->request('GET', '/config');
|
||||
|
||||
$this->assertEquals(200, $client->getResponse()->getStatusCode());
|
||||
|
||||
$form = $crawler->filter('button[id=tagging_rule_save]')->form();
|
||||
|
||||
$crawler = $client->submit($form, [
|
||||
'tagging_rule[rule]' => str_repeat('title', 60),
|
||||
'tagging_rule[tags]' => 'cool tag',
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $client->getResponse()->getStatusCode());
|
||||
|
||||
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
|
||||
|
||||
$this->assertContains('255 characters', $body[0]);
|
||||
}
|
||||
|
||||
public function testDeletingTaggingRuleFromAnOtherUser()
|
||||
{
|
||||
$this->logInAs('bob');
|
||||
|
|
Loading…
Reference in a new issue