From a089ff5eb0dcdab83c6c2e64cb0e7cb618aec41f Mon Sep 17 00:00:00 2001 From: MateBartus Date: Wed, 25 Feb 2015 21:13:20 +0100 Subject: [ticket/13654] Moving reporting into controller Moving report.php's content into different services and controllers to better comply with the MVC model. Also implementing: * Replacement for reasons_display() * Adding assign_meta_refresh_var() to \controller\helper * Adding separate routes for easy configuration * Updating unit tests to expect to correct results * Add BC tests PHPBB3-13654 --- .../functional/controllers_compatibility_test.php | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/functional/controllers_compatibility_test.php (limited to 'tests/functional/controllers_compatibility_test.php') 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 @@ + +* @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); + } +} -- cgit v1.2.1 From 8e5e954438b232f4ce7aec6a5db3d52b974c07a8 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Sun, 22 Feb 2015 23:36:27 +0100 Subject: [ticket/13645] Move the feeds to controllers PHPBB3-13645 --- tests/functional/controllers_compatibility_test.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/functional/controllers_compatibility_test.php') diff --git a/tests/functional/controllers_compatibility_test.php b/tests/functional/controllers_compatibility_test.php index 7ba0b0d991..9499888a1a 100644 --- a/tests/functional/controllers_compatibility_test.php +++ b/tests/functional/controllers_compatibility_test.php @@ -24,6 +24,19 @@ class phpbb_functional_controllers_compatibility_test extends phpbb_functional_t $this->assert301('report.php?pm=1', 'app.php/pm/1/report'); } + public function test_feed_compatibility() + { + $this->assert301('feed.php', 'app.php/feed'); + $this->assert301('feed.php?mode=foobar', 'app.php/feed/foobar'); + $this->assert301('feed.php?mode=news', 'app.php/feed/news'); + $this->assert301('feed.php?mode=topics', 'app.php/feed/topics'); + $this->assert301('feed.php?mode=topics_news', 'app.php/feed/topics_news'); + $this->assert301('feed.php?mode=topics_active', 'app.php/feed/topics_active'); + $this->assert301('feed.php?mode=forums', 'app.php/feed/forums'); + $this->assert301('feed.php?f=1', 'app.php/feed/forum/1'); + $this->assert301('feed.php?t=1', 'app.php/feed/topic/1'); + } + protected function assert301($from, $to) { self::$client->followRedirects(false); -- cgit v1.2.1