From 865bf0db3d5ca3f8bbadd009ce0a5e8324de49c1 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 20 Jul 2013 22:35:45 +0200 Subject: [ticket/11720] Add functional test for submitting report as user The already existing functional tests were not ran as the filename was missing the appended "_test". PHPBB3-11720 --- tests/functional/report_post_captcha.php | 61 ------------------------- tests/functional/report_post_captcha_test.php | 66 +++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 61 deletions(-) delete mode 100644 tests/functional/report_post_captcha.php create mode 100644 tests/functional/report_post_captcha_test.php (limited to 'tests/functional') diff --git a/tests/functional/report_post_captcha.php b/tests/functional/report_post_captcha.php deleted file mode 100644 index af713775c5..0000000000 --- a/tests/functional/report_post_captcha.php +++ /dev/null @@ -1,61 +0,0 @@ -login(); - $crawler = self::request('GET', 'report.php?f=2&p=1'); - $this->assertNotContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text()); - } - - public function test_guest_report_post() - { - $crawler = self::request('GET', 'report.php?f=2&p=1'); - $this->add_lang('mcp'); - $this->assertContains($this->lang('USER_CANNOT_REPORT'), $crawler->filter('html')->text()); - - $this->set_reporting_guest(1); - $crawler = self::request('GET', 'report.php?f=2&p=1'); - $this->assertContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text()); - $this->set_reporting_guest(-1); - } - - protected function set_reporting_guest($report_post_allowed) - { - $this->login(); - $this->admin_login(); - - $crawler = self::request('GET', 'adm/index.php?i=permissions&icat=12&mode=setting_group_local&sid=' . $this->sid); - $form = $crawler->selectButton('Submit')->form(); - $values = $form->getValues(); - $values["group_id[0]"] = 1; - $form->setValues($values); - $crawler = self::submit($form); - - $form = $crawler->selectButton('Submit')->form(); - $values = $form->getValues(); - $values["forum_id"] = 2; - $form->setValues($values); - $crawler = self::submit($form); - - $this->add_lang('acp/permissions'); - $form = $crawler->selectButton($this->lang('APPLY_ALL_PERMISSIONS'))->form(); - $values = $form->getValues(); - $values["setting[1][2][f_report]"] = $report_post_allowed; - $form->setValues($values); - $crawler = self::submit($form); - - $crawler = self::request('GET', 'ucp.php?mode=logout&sid=' . $this->sid); - } -} diff --git a/tests/functional/report_post_captcha_test.php b/tests/functional/report_post_captcha_test.php new file mode 100644 index 0000000000..8283465041 --- /dev/null +++ b/tests/functional/report_post_captcha_test.php @@ -0,0 +1,66 @@ +add_lang('mcp'); + $this->assertContains($this->lang('USER_CANNOT_REPORT'), $crawler->filter('html')->text()); + + $this->set_reporting_guest(1); + $crawler = self::request('GET', 'report.php?f=2&p=1'); + $this->assertContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text()); + $this->set_reporting_guest(-1); + } + + public function test_user_report_post() + { + $this->login(); + $crawler = self::request('GET', 'report.php?f=2&p=1'); + $this->assertNotContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text()); + + $this->add_lang('mcp'); + $form = $crawler->selectButton($this->lang('SUBMIT'))->form(); + $crawler = self::submit($form); + $this->assertContains($this->lang('POST_REPORTED_SUCCESS'), $crawler->text()); + } + + protected function set_reporting_guest($report_post_allowed) + { + $this->login(); + $this->admin_login(); + + $crawler = self::request('GET', 'adm/index.php?i=permissions&icat=12&mode=setting_group_local&sid=' . $this->sid); + $form = $crawler->selectButton('Submit')->form(); + $values = $form->getValues(); + $values["group_id[0]"] = 1; + $form->setValues($values); + $crawler = self::submit($form); + + $form = $crawler->selectButton('Submit')->form(); + $values = $form->getValues(); + $values["forum_id"] = 2; + $form->setValues($values); + $crawler = self::submit($form); + + $this->add_lang('acp/permissions'); + $form = $crawler->selectButton($this->lang('APPLY_ALL_PERMISSIONS'))->form(); + $values = $form->getValues(); + $values["setting[1][2][f_report]"] = $report_post_allowed; + $form->setValues($values); + $crawler = self::submit($form); + + $crawler = self::request('GET', 'ucp.php?mode=logout&sid=' . $this->sid); + } +} -- cgit v1.2.1