Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 16 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
| phpbb_functional_ucp_pm_test | |
0.00% |
0 / 16 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 1 |
| setUp | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| test_pm_enabled | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| test_pm_disabled | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| set_allow_pm | |
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_ucp_pm_test extends phpbb_functional_test_case |
| 18 | { |
| 19 | protected function setUp(): void |
| 20 | { |
| 21 | parent::setUp(); |
| 22 | $this->login(); |
| 23 | $this->admin_login(); |
| 24 | } |
| 25 | |
| 26 | public function test_pm_enabled() |
| 27 | { |
| 28 | $crawler = self::request('GET', 'ucp.php'); |
| 29 | $this->assertContainsLang('PRIVATE_MESSAGES', $crawler->filter('html')->text()); |
| 30 | } |
| 31 | |
| 32 | public function test_pm_disabled() |
| 33 | { |
| 34 | $this->set_allow_pm(0); |
| 35 | $crawler = self::request('GET', 'ucp.php'); |
| 36 | $this->assertNotContainsLang('PRIVATE_MESSAGES', $crawler->filter('html')->text()); |
| 37 | $this->set_allow_pm(1); |
| 38 | } |
| 39 | |
| 40 | protected function set_allow_pm($enable_pm) |
| 41 | { |
| 42 | $crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=message'); |
| 43 | |
| 44 | $form = $crawler->selectButton('Submit')->form(); |
| 45 | $values = $form->getValues(); |
| 46 | |
| 47 | $values["config[allow_privmsg]"] = $enable_pm; |
| 48 | $form->setValues($values); |
| 49 | $crawler = self::submit($form); |
| 50 | $this->assertGreaterThan(0, $crawler->filter('.successbox')->count()); |
| 51 | } |
| 52 | } |