aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2013-05-08 08:23:11 -0400
committerOleg Pudeyev <oleg@bsdpower.com>2013-05-08 08:23:11 -0400
commit88d4964f0ee56f3c9dadc67c8e62b055568e6898 (patch)
treead51b323b6e0586159c87a34d80eb46434666f63 /tests
parent1a062c506412f4046a336701c8d4d53d45eac954 (diff)
parent284011ebf256bffb9544493c7b82f90eeff4ae39 (diff)
downloadforums-88d4964f0ee56f3c9dadc67c8e62b055568e6898.tar
forums-88d4964f0ee56f3c9dadc67c8e62b055568e6898.tar.gz
forums-88d4964f0ee56f3c9dadc67c8e62b055568e6898.tar.bz2
forums-88d4964f0ee56f3c9dadc67c8e62b055568e6898.tar.xz
forums-88d4964f0ee56f3c9dadc67c8e62b055568e6898.zip
Merge PR #1209 branch 'dhruvgoel92/ticket/10325' into develop
# By Dhruv # Via Dhruv * dhruvgoel92/ticket/10325: [ticket/10325] move migration into a new file [ticket/10325] fix acp language [ticket/10325] use assert_response_success parts [ticket/10325] fix language in acp and ucp [ticket/10325] add assert_response_success in test [ticket/10325] functional tests for forgot password functionality [ticket/10325] add logout function in functional_test_case [ticket/10325] fix language in acp and ucp [ticket/10325] improve acp option language [ticket/10325] fix language key [ticket/10325] fix language variable [ticket/10325] change language var [ticket/10325] fix language [ticket/10325] add new config value to database [ticket/10325] trigger error if forgot password option disabled [ticket/10325] add allow forgot password option in acp
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/forgot_password_test.php51
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php11
2 files changed, 62 insertions, 0 deletions
diff --git a/tests/functional/forgot_password_test.php b/tests/functional/forgot_password_test.php
new file mode 100644
index 0000000000..bfb4616d64
--- /dev/null
+++ b/tests/functional/forgot_password_test.php
@@ -0,0 +1,51 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @group functional
+*/
+class phpbb_functional_forgot_password_test extends phpbb_functional_test_case
+{
+ public function test_forgot_password_enabled()
+ {
+ global $config;
+ $this->add_lang('ucp');
+ $crawler = $this->request('GET', 'ucp.php?mode=sendpassword');
+ $this->assert_response_success();
+ $this->assertEquals($this->lang('SEND_PASSWORD'), $crawler->filter('h2')->text());
+ }
+
+ public function test_forgot_password_disabled()
+ {
+ $this->login();
+ $this->admin_login();
+ $this->add_lang('ucp');
+ $crawler = $this->request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=security');
+ $this->assertEquals(200, $this->client->getResponse()->getStatus());
+ $content = $this->client->getResponse()->getContent();
+ $this->assertNotContains('Fatal error:', $content);
+ $this->assertNotContains('Notice:', $content);
+ $this->assertNotContains('[phpBB Debug]', $content);
+
+ $form = $crawler->selectButton('Submit')->form();
+ $values = $form->getValues();
+
+ $values["config[allow_password_reset]"] = 0;
+ $form->setValues($values);
+ $crawler = $this->client->submit($form);
+
+ $this->logout();
+
+ $crawler = $this->request('GET', 'ucp.php?mode=sendpassword');
+ $this->assert_response_success();
+ $this->assertContains($this->lang('UCP_PASSWORD_RESET_DISABLED', '', ''), $crawler->text());
+
+ }
+
+}
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index 5534de89c9..dae37f336d 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -425,6 +425,17 @@ class phpbb_functional_test_case extends phpbb_test_case
}
}
+ protected function logout()
+ {
+ $this->add_lang('ucp');
+
+ $crawler = $this->request('GET', 'ucp.php?sid=' . $this->sid . '&mode=logout');
+ $this->assert_response_success();
+ $this->assertContains($this->lang('LOGOUT_REDIRECT'), $crawler->filter('#message')->text());
+ unset($this->sid);
+
+ }
+
/**
* Login to the ACP
* You must run login() before calling this.