diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-01-21 18:06:10 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-01-22 08:01:17 +0100 |
commit | a3cac44c78a1d798e3282daa6b8c3e59e8ebc690 (patch) | |
tree | 9bc2886abd9483812eea97bb351cf3ec43d4e17c /src | |
parent | 0f0e8eb82a3374e20453fb1f8046325ee306b036 (diff) | |
download | wallabag-a3cac44c78a1d798e3282daa6b8c3e59e8ebc690.tar.gz wallabag-a3cac44c78a1d798e3282daa6b8c3e59e8ebc690.tar.zst wallabag-a3cac44c78a1d798e3282daa6b8c3e59e8ebc690.zip |
Add for deleting rule from an other user
Diffstat (limited to 'src')
-rw-r--r-- | src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php | 55 |
1 files changed, 49 insertions, 6 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php index 89ca31e2..c8807425 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php | |||
@@ -520,18 +520,61 @@ class ConfigControllerTest extends WallabagCoreTestCase | |||
520 | return array( | 520 | return array( |
521 | array( | 521 | array( |
522 | array( | 522 | array( |
523 | 'rss_config[rule]' => 'unknownVar <= 3', | 523 | 'tagging_rule[rule]' => 'unknownVar <= 3', |
524 | 'rss_config[tags]' => 'cool tag', | 524 | 'tagging_rule[tags]' => 'cool tag', |
525 | ), | ||
526 | array( | ||
527 | 'The variable', | ||
528 | 'does not exist.', | ||
525 | ), | 529 | ), |
526 | 'The variable « unknownVar » does not exist.', | ||
527 | ), | 530 | ), |
528 | array( | 531 | array( |
529 | array( | 532 | array( |
530 | 'rss_config[rule]' => 'length(domainName) <= 42', | 533 | 'tagging_rule[rule]' => 'length(domainName) <= 42', |
531 | 'rss_config[tags]' => 'cool tag', | 534 | 'tagging_rule[tags]' => 'cool tag', |
535 | ), | ||
536 | array( | ||
537 | 'The operator', | ||
538 | 'does not exist.', | ||
532 | ), | 539 | ), |
533 | 'The operator « length » does not exist.', | ||
534 | ), | 540 | ), |
535 | ); | 541 | ); |
536 | } | 542 | } |
543 | |||
544 | /** | ||
545 | * @dataProvider dataForTaggingRuleFailed | ||
546 | */ | ||
547 | public function testTaggingRuleCreationFail($data, $messages) | ||
548 | { | ||
549 | $this->logInAs('admin'); | ||
550 | $client = $this->getClient(); | ||
551 | |||
552 | $crawler = $client->request('GET', '/config'); | ||
553 | |||
554 | $this->assertTrue($client->getResponse()->isSuccessful()); | ||
555 | |||
556 | $form = $crawler->filter('button[id=tagging_rule_save]')->form(); | ||
557 | |||
558 | $client->submit($form, $data); | ||
559 | |||
560 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
561 | |||
562 | foreach ($messages as $message) { | ||
563 | $this->assertContains($message, $client->getResponse()->getContent()); | ||
564 | } | ||
565 | } | ||
566 | |||
567 | public function testDeletingTaggingRuleFromAnOtherUser() | ||
568 | { | ||
569 | $this->logInAs('bob'); | ||
570 | $client = $this->getClient(); | ||
571 | |||
572 | $rule = $client->getContainer()->get('doctrine.orm.entity_manager') | ||
573 | ->getRepository('WallabagCoreBundle:TaggingRule') | ||
574 | ->findAll()[0]; | ||
575 | |||
576 | $client->request('GET', '/tagging-rule/delete/'.$rule->getId()); | ||
577 | $this->assertEquals(403, $client->getResponse()->getStatusCode()); | ||
578 | $this->assertContains('You can not access this tagging ryle', $client->getResponse()->getContent()); | ||
579 | } | ||
537 | } | 580 | } |