Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 22 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| phpbb_functional_forgot_password_test | |
0.00% |
0 / 22 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
| test_forgot_password_enabled | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| test_forgot_password_disabled | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
2 | |||
| tearDown | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * |
| 4 | * This file is part of the phpBB Forum Software package. |
| 5 | * |
| 6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
| 7 | * @license GNU General Public License, version 2 (GPL-2.0) |
| 8 | * |
| 9 | * For full copyright and license information, please see |
| 10 | * the docs/CREDITS.txt file. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | /** |
| 15 | * @group functional |
| 16 | */ |
| 17 | class phpbb_functional_forgot_password_test extends phpbb_functional_test_case |
| 18 | { |
| 19 | public function test_forgot_password_enabled() |
| 20 | { |
| 21 | $this->add_lang('ucp'); |
| 22 | $crawler = self::request('GET', 'app.php/user/forgot_password'); |
| 23 | $this->assertEquals($this->lang('RESET_PASSWORD'), $crawler->filter('h2')->text()); |
| 24 | } |
| 25 | |
| 26 | public function test_forgot_password_disabled() |
| 27 | { |
| 28 | $this->login(); |
| 29 | $this->admin_login(); |
| 30 | $this->add_lang('ucp'); |
| 31 | $crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=security'); |
| 32 | |
| 33 | $form = $crawler->selectButton('Submit')->form(); |
| 34 | $values = $form->getValues(); |
| 35 | |
| 36 | $values["config[allow_password_reset]"] = 0; |
| 37 | $form->setValues($values); |
| 38 | $crawler = self::submit($form); |
| 39 | |
| 40 | $this->logout(); |
| 41 | |
| 42 | $crawler = self::request('GET', 'app.php/user/forgot_password'); |
| 43 | $this->assertStringContainsString($this->lang('UCP_PASSWORD_RESET_DISABLED', '', ''), $crawler->text()); |
| 44 | |
| 45 | } |
| 46 | |
| 47 | protected function tearDown(): void |
| 48 | { |
| 49 | $this->login(); |
| 50 | $this->admin_login(); |
| 51 | |
| 52 | $crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=security'); |
| 53 | |
| 54 | // Enable allow_password_reset again after test |
| 55 | $form = $crawler->selectButton('Submit')->form(array( |
| 56 | 'config[allow_password_reset]' => 1, |
| 57 | )); |
| 58 | $crawler = self::submit($form); |
| 59 | } |
| 60 | } |