aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2014-09-19 00:11:36 +0200
committerMarc Alexander <admin@m-a-styles.de>2014-09-19 00:11:36 +0200
commitd74f45aee0164d6189c3bb4182d67f345b1d9d6e (patch)
treeb212b594a67bfdb495f5853906c0f455f45cb769
parenta70addbf14bde4be8c8181d09baf37084c5362f2 (diff)
downloadforums-d74f45aee0164d6189c3bb4182d67f345b1d9d6e.tar
forums-d74f45aee0164d6189c3bb4182d67f345b1d9d6e.tar.gz
forums-d74f45aee0164d6189c3bb4182d67f345b1d9d6e.tar.bz2
forums-d74f45aee0164d6189c3bb4182d67f345b1d9d6e.tar.xz
forums-d74f45aee0164d6189c3bb4182d67f345b1d9d6e.zip
[ticket/13073] Test that routes from subfolders like /adm work
PHPBB3-13073
-rw-r--r--tests/controller/helper_route_adm_test.php96
-rw-r--r--tests/controller/helper_route_test.php18
2 files changed, 13 insertions, 101 deletions
diff --git a/tests/controller/helper_route_adm_test.php b/tests/controller/helper_route_adm_test.php
index bd462fa359..ec7fc0c490 100644
--- a/tests/controller/helper_route_adm_test.php
+++ b/tests/controller/helper_route_adm_test.php
@@ -22,8 +22,7 @@ class phpbb_controller_helper_route_adm_test extends phpbb_controller_helper_rou
{
global $phpbb_dispatcher, $phpbb_root_path, $phpEx;
- $phpbb_dispatcher = new phpbb_mock_event_dispatcher;
- $this->user = new \phpbb\user('\phpbb\datetime');
+ parent::setUp();
$request = new phpbb_mock_request();
$request->overwrite('SCRIPT_NAME', '/adm/index.php', \phpbb\request\request_interface::SERVER);
@@ -43,18 +42,6 @@ class phpbb_controller_helper_route_adm_test extends phpbb_controller_helper_rou
$phpbb_root_path,
$phpEx
);
- $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
- $this->template = new phpbb\template\twig\twig($phpbb_path_helper, $this->config, $this->user, new \phpbb\template\context());
- $this->extension_manager = new phpbb_mock_extension_manager(
- dirname(__FILE__) . '/',
- array(
- 'vendor2/foo' => array(
- 'ext_name' => 'vendor2/foo',
- 'ext_active' => '1',
- 'ext_path' => 'ext/vendor2/foo/',
- ),
- )
- );
$finder = new \phpbb\finder(
new \phpbb\filesystem(),
@@ -65,84 +52,7 @@ class phpbb_controller_helper_route_adm_test extends phpbb_controller_helper_rou
$this->provider = new \phpbb\controller\provider();
$this->provider->find_routing_files($finder);
$this->provider->find(dirname(__FILE__) . '/');
- }
-
- /**
- * @dataProvider helper_url_data_no_rewrite()
- */
- public function test_helper_url_no_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
- {
- $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/');
- $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id));
- }
-
- /**
- * @dataProvider helper_url_data_with_rewrite()
- */
- public function test_helper_url_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
- {
- $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
- $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/');
- $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id));
- }
-
- /**
- * @dataProvider helper_url_data_absolute()
- */
- public function test_helper_url_absolute($route, $params, $is_amp, $session_id, $expected, $description)
- {
- $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
- $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/');
- $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL));
- }
-
- /**
- * @dataProvider helper_url_data_relative_path()
- */
- public function test_helper_url_relative_path($route, $params, $is_amp, $session_id, $expected, $description)
- {
- $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
- $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/');
- $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH));
- }
-
- /**
- * @dataProvider helper_url_data_network()
- */
- public function test_helper_url_network($route, $params, $is_amp, $session_id, $expected, $description)
- {
- $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
- $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/');
- $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH));
- }
-
- /**
- * @dataProvider helper_url_data_absolute_with_rewrite()
- */
- public function test_helper_url_absolute_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
- {
- $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
- $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/');
- $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL));
- }
-
- /**
- * @dataProvider helper_url_data_relative_path_with_rewrite()
- */
- public function test_helper_url_relative_path_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
- {
- $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
- $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/');
- $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH));
- }
-
- /**
- * @dataProvider helper_url_data_network_with_rewrite()
- */
- public function test_helper_url_network_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
- {
- $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
- $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, './../', 'php', dirname(__FILE__) . '/');
- $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH));
+ // Set correct current phpBB root path
+ $this->root_path = './../';
}
}
diff --git a/tests/controller/helper_route_test.php b/tests/controller/helper_route_test.php
index e906e79164..94e006166a 100644
--- a/tests/controller/helper_route_test.php
+++ b/tests/controller/helper_route_test.php
@@ -17,6 +17,8 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
class phpbb_controller_helper_route_test extends phpbb_test_case
{
+ protected $root_path;
+
public function setUp()
{
global $phpbb_dispatcher, $phpbb_root_path, $phpEx;
@@ -101,7 +103,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case
*/
public function test_helper_url_no_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
{
- $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/');
+ $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, $this->root_path, 'php', dirname(__FILE__) . '/');
$this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id));
}
@@ -141,7 +143,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case
public function test_helper_url_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
{
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
- $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/');
+ $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, $this->root_path, 'php', dirname(__FILE__) . '/');
$this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id));
}
@@ -181,7 +183,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case
public function test_helper_url_absolute($route, $params, $is_amp, $session_id, $expected, $description)
{
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
- $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/');
+ $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, $this->root_path, 'php', dirname(__FILE__) . '/');
$this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL));
}
@@ -221,7 +223,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case
public function test_helper_url_relative_path($route, $params, $is_amp, $session_id, $expected, $description)
{
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
- $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/');
+ $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, $this->root_path, 'php', dirname(__FILE__) . '/');
$this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH));
}
@@ -261,7 +263,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case
public function test_helper_url_network($route, $params, $is_amp, $session_id, $expected, $description)
{
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
- $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/');
+ $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, $this->root_path, 'php', dirname(__FILE__) . '/');
$this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH));
}
//TODO
@@ -301,7 +303,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case
public function test_helper_url_absolute_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
{
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
- $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/');
+ $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, $this->root_path, 'php', dirname(__FILE__) . '/');
$this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::ABSOLUTE_URL));
}
@@ -341,7 +343,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case
public function test_helper_url_relative_path_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
{
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
- $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/');
+ $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, $this->root_path, 'php', dirname(__FILE__) . '/');
$this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::RELATIVE_PATH));
}
@@ -381,7 +383,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case
public function test_helper_url_network_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
{
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
- $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, '', 'php', dirname(__FILE__) . '/');
+ $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, $this->symfony_request, $this->filesystem, $this->root_path, 'php', dirname(__FILE__) . '/');
$this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH));
}
}