aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functional/forgot_password_test.php
blob: 64fa19557fc5d9076aa83ad79fdde348706006a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/

/**
* @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 = self::request('GET', 'ucp.php?mode=sendpassword');
		$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 = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=security');

		$form = $crawler->selectButton('Submit')->form();
		$values = $form->getValues();

		$values["config[allow_password_reset]"] = 0;
		$form->setValues($values);
		$crawler = self::submit($form);

		$this->logout();

		$crawler = self::request('GET', 'ucp.php?mode=sendpassword');
		$this->assertContains($this->lang('UCP_PASSWORD_RESET_DISABLED', '', ''), $crawler->text());

	}

	public function tearDown()
	{
		$this->login();
		$this->admin_login();

		$crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=security');

		// Enable allow_password_reset again after test
		$form = $crawler->selectButton('Submit')->form(array(
			'config[allow_password_reset]'	=> 1,
		));
		$crawler = self::submit($form);
	}
}