mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/13073] Test that routes from subfolders like /adm work
PHPBB3-13073
This commit is contained in:
parent
a70addbf14
commit
d74f45aee0
2 changed files with 13 additions and 101 deletions
|
@ -22,8 +22,7 @@ class phpbb_controller_helper_route_adm_test extends phpbb_controller_helper_rou
|
||||||
{
|
{
|
||||||
global $phpbb_dispatcher, $phpbb_root_path, $phpEx;
|
global $phpbb_dispatcher, $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher;
|
parent::setUp();
|
||||||
$this->user = new \phpbb\user('\phpbb\datetime');
|
|
||||||
|
|
||||||
$request = new phpbb_mock_request();
|
$request = new phpbb_mock_request();
|
||||||
$request->overwrite('SCRIPT_NAME', '/adm/index.php', \phpbb\request\request_interface::SERVER);
|
$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,
|
$phpbb_root_path,
|
||||||
$phpEx
|
$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(
|
$finder = new \phpbb\finder(
|
||||||
new \phpbb\filesystem(),
|
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 = new \phpbb\controller\provider();
|
||||||
$this->provider->find_routing_files($finder);
|
$this->provider->find_routing_files($finder);
|
||||||
$this->provider->find(dirname(__FILE__) . '/');
|
$this->provider->find(dirname(__FILE__) . '/');
|
||||||
}
|
// Set correct current phpBB root path
|
||||||
|
$this->root_path = './../';
|
||||||
/**
|
|
||||||
* @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));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
|
|
||||||
class phpbb_controller_helper_route_test extends phpbb_test_case
|
class phpbb_controller_helper_route_test extends phpbb_test_case
|
||||||
{
|
{
|
||||||
|
protected $root_path;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
global $phpbb_dispatcher, $phpbb_root_path, $phpEx;
|
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)
|
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));
|
$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)
|
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->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));
|
$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)
|
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->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));
|
$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)
|
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->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));
|
$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)
|
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->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));
|
$this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH));
|
||||||
}
|
}
|
||||||
//TODO
|
//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)
|
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->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));
|
$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)
|
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->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));
|
$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)
|
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->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));
|
$this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id, UrlGeneratorInterface::NETWORK_PATH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue