aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functional
diff options
context:
space:
mode:
authorTristan Darricau <tristan.darricau@sensiolabs.com>2015-04-16 21:30:52 +0200
committerTristan Darricau <tristan.darricau@sensiolabs.com>2015-04-16 21:30:52 +0200
commitc89384eb86c0d2ff89f9df69dbd14fb61cfcb624 (patch)
tree98bac3192ed32ea6483c33a77aadc1c1f95200cf /tests/functional
parentf077b72d0ddabd13350bea276069b68d5df4a89c (diff)
parenta089ff5eb0dcdab83c6c2e64cb0e7cb618aec41f (diff)
downloadforums-c89384eb86c0d2ff89f9df69dbd14fb61cfcb624.tar
forums-c89384eb86c0d2ff89f9df69dbd14fb61cfcb624.tar.gz
forums-c89384eb86c0d2ff89f9df69dbd14fb61cfcb624.tar.bz2
forums-c89384eb86c0d2ff89f9df69dbd14fb61cfcb624.tar.xz
forums-c89384eb86c0d2ff89f9df69dbd14fb61cfcb624.zip
Merge pull request #3446 from MateBartus/ticket/13654
[ticket/13654] Moving reporting into controller
Diffstat (limited to 'tests/functional')
-rw-r--r--tests/functional/controllers_compatibility_test.php43
-rw-r--r--tests/functional/report_post_captcha_test.php7
2 files changed, 47 insertions, 3 deletions
diff --git a/tests/functional/controllers_compatibility_test.php b/tests/functional/controllers_compatibility_test.php
new file mode 100644
index 0000000000..7ba0b0d991
--- /dev/null
+++ b/tests/functional/controllers_compatibility_test.php
@@ -0,0 +1,43 @@
+<?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_controllers_compatibility_test extends phpbb_functional_test_case
+{
+ public function test_report_compatibility()
+ {
+ $this->assert301('report.php?f=1&p=1', 'app.php/post/1/report');
+ $this->assert301('report.php?p=1', 'app.php/post/1/report');
+ $this->assert301('report.php?pm=1', 'app.php/pm/1/report');
+ }
+
+ protected function assert301($from, $to)
+ {
+ self::$client->followRedirects(false);
+ self::request('GET', $from, array(), false);
+
+ // Fix sid issues
+ $location = self::$client->getResponse()->getHeader('Location');
+ $location = preg_replace('#sid=[^&]+(&(amp;)?)?#', '', $location);
+ if (substr($location, -1) === '?')
+ {
+ $location = substr($location, 0, -1);
+ }
+
+ $this->assertEquals(301, self::$client->getResponse()->getStatus());
+ $this->assertStringEndsWith($to, $location);
+ }
+}
diff --git a/tests/functional/report_post_captcha_test.php b/tests/functional/report_post_captcha_test.php
index 93a03bd931..36a1a9ee4d 100644
--- a/tests/functional/report_post_captcha_test.php
+++ b/tests/functional/report_post_captcha_test.php
@@ -18,12 +18,13 @@ class phpbb_functional_report_post_captcha_test extends phpbb_functional_test_ca
{
public function test_guest_report_post()
{
- $crawler = self::request('GET', 'report.php?f=2&p=1');
+ $crawler = self::request('GET', 'app.php/post/1/report', array(), false);
+ $this->assert_response_html(403);
$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');
+ $crawler = self::request('GET', 'app.php/post/1/report');
$this->assertContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text());
$this->set_reporting_guest(-1);
}
@@ -31,7 +32,7 @@ class phpbb_functional_report_post_captcha_test extends phpbb_functional_test_ca
public function test_user_report_post()
{
$this->login();
- $crawler = self::request('GET', 'report.php?f=2&p=1');
+ $crawler = self::request('GET', 'app.php/post/1/report');
$this->assertNotContains($this->lang('CONFIRM_CODE'), $crawler->filter('html')->text());
$this->add_lang('mcp');