X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FTests%2FController%2FConfigControllerTest.php;h=2af93ffecffe7051dfc114a453b297def5b86189;hb=9bf15f02695823652a0e783c915b039836f51626;hp=c8807425aa031bcc82ee6cbf19aa6efb949b4552;hpb=85ad629a3ca209907effd75f5fd7f384f42361bc;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php index c8807425..2af93ffe 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php @@ -293,7 +293,7 @@ class ConfigControllerTest extends WallabagCoreTestCase 'new_user[plainPassword][second]' => 'mypassword2', 'new_user[email]' => 'wallace@wallace.me', ), - 'This value is not valid', + 'The password fields must match', ), ); } @@ -577,4 +577,34 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertEquals(403, $client->getResponse()->getStatusCode()); $this->assertContains('You can not access this tagging ryle', $client->getResponse()->getContent()); } + + public function testDemoMode() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $config = $client->getContainer()->get('craue_config'); + $config->set('demo_mode_enabled', 1); + $config->set('demo_mode_username', 'admin'); + + $crawler = $client->request('GET', '/config'); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + + $form = $crawler->filter('button[id=change_passwd_save]')->form(); + + $data = array( + 'change_passwd[old_password]' => 'mypassword', + 'change_passwd[new_password][first]' => 'mypassword', + 'change_passwd[new_password][second]' => 'mypassword', + ); + + $client->submit($form, $data); + + $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertContains('In demonstration mode, you can\'t change password for this user.', $client->getContainer()->get('session')->getFlashBag()->get('notice')[0]); + + $config->set('demo_mode_enabled', 0); + $config->set('demo_mode_username', 'wallabag'); + } }