aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-02-22 14:18:34 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2016-02-22 14:18:34 +0100
commit2aadeea8cd968a2e32631b166097748611a520f6 (patch)
tree2a167eaae0edea08060abfd132aec3c4a7239207 /src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
parent2b71f68c95acd20b9ee5e6dc4d67a1ec649fc440 (diff)
parentb6c00b0b807108cd54ab32fa73f9c196f4f12d97 (diff)
downloadwallabag-2aadeea8cd968a2e32631b166097748611a520f6.tar.gz
wallabag-2aadeea8cd968a2e32631b166097748611a520f6.tar.zst
wallabag-2aadeea8cd968a2e32631b166097748611a520f6.zip
Merge pull request #1683 from wallabag/v2-demo
Demonstration mode to prevent password changes
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php')
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
index 6c370a2d..2af93ffe 100644
--- a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
@@ -577,4 +577,34 @@ class ConfigControllerTest extends WallabagCoreTestCase
577 $this->assertEquals(403, $client->getResponse()->getStatusCode()); 577 $this->assertEquals(403, $client->getResponse()->getStatusCode());
578 $this->assertContains('You can not access this tagging ryle', $client->getResponse()->getContent()); 578 $this->assertContains('You can not access this tagging ryle', $client->getResponse()->getContent());
579 } 579 }
580
581 public function testDemoMode()
582 {
583 $this->logInAs('admin');
584 $client = $this->getClient();
585
586 $config = $client->getContainer()->get('craue_config');
587 $config->set('demo_mode_enabled', 1);
588 $config->set('demo_mode_username', 'admin');
589
590 $crawler = $client->request('GET', '/config');
591
592 $this->assertEquals(200, $client->getResponse()->getStatusCode());
593
594 $form = $crawler->filter('button[id=change_passwd_save]')->form();
595
596 $data = array(
597 'change_passwd[old_password]' => 'mypassword',
598 'change_passwd[new_password][first]' => 'mypassword',
599 'change_passwd[new_password][second]' => 'mypassword',
600 );
601
602 $client->submit($form, $data);
603
604 $this->assertEquals(302, $client->getResponse()->getStatusCode());
605 $this->assertContains('In demonstration mode, you can\'t change password for this user.', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]);
606
607 $config->set('demo_mode_enabled', 0);
608 $config->set('demo_mode_username', 'wallabag');
609 }
580} 610}