Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 35 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| phpbb_functional_report_post_captcha_test | |
0.00% |
0 / 35 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
| test_guest_report_post | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
2 | |||
| test_user_report_post | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
| set_reporting_guest | |
0.00% |
0 / 20 |
|
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_report_post_captcha_test extends phpbb_functional_test_case |
| 18 | { |
| 19 | public function test_guest_report_post() |
| 20 | { |
| 21 | $crawler = self::request('GET', 'app.php/post/1/report', array(), false); |
| 22 | $this->assert_response_html(403); |
| 23 | $this->add_lang('mcp'); |
| 24 | $this->assertStringContainsString($this->lang('USER_CANNOT_REPORT'), $crawler->filter('html')->text()); |
| 25 | |
| 26 | $this->set_reporting_guest(1); |
| 27 | $crawler = self::request('GET', 'app.php/post/1/report'); |
| 28 | $this->assertStringContainsString($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text()); |
| 29 | $this->set_reporting_guest(-1); |
| 30 | } |
| 31 | |
| 32 | public function test_user_report_post() |
| 33 | { |
| 34 | $this->login(); |
| 35 | $crawler = self::request('GET', 'app.php/post/1/report'); |
| 36 | $this->assertStringNotContainsString($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text()); |
| 37 | |
| 38 | $this->add_lang('mcp'); |
| 39 | $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); |
| 40 | $crawler = self::submit($form); |
| 41 | $this->assertStringContainsString($this->lang('POST_REPORTED_SUCCESS'), $crawler->text()); |
| 42 | } |
| 43 | |
| 44 | protected function set_reporting_guest($report_post_allowed) |
| 45 | { |
| 46 | $this->login(); |
| 47 | $this->admin_login(); |
| 48 | |
| 49 | $crawler = self::request('GET', 'adm/index.php?i=permissions&icat=12&mode=setting_group_local&sid=' . $this->sid); |
| 50 | $form = $crawler->selectButton('Submit')->form(); |
| 51 | $values = $form->getValues(); |
| 52 | $values["group_id[0]"] = 1; |
| 53 | $form->setValues($values); |
| 54 | $crawler = self::submit($form); |
| 55 | |
| 56 | $form = $crawler->selectButton('Submit')->form(); |
| 57 | $values = $form->getValues(); |
| 58 | $values["forum_id"] = 2; |
| 59 | $form->setValues($values); |
| 60 | $crawler = self::submit($form); |
| 61 | |
| 62 | $this->add_lang('acp/permissions'); |
| 63 | $form = $crawler->selectButton($this->lang('APPLY_ALL_PERMISSIONS'))->form(); |
| 64 | $values = $form->getValues(); |
| 65 | $values["setting[1][2][f_report]"] = $report_post_allowed; |
| 66 | $form->setValues($values); |
| 67 | self::submit($form); |
| 68 | |
| 69 | $this->logout(); |
| 70 | } |
| 71 | } |