mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/11997] Move expected redirect returns to controller and output to HTML
The controller will now output the expected redirect returns the same way the redirect returns are output. The extension controller test will compare those 2 outputs. PHPBB3-11997
This commit is contained in:
parent
47ea6bc9e6
commit
15913fdf79
3 changed files with 62 additions and 27 deletions
|
@ -121,23 +121,18 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
|
||||||
$this->phpbb_extension_manager->enable('foo/bar');
|
$this->phpbb_extension_manager->enable('foo/bar');
|
||||||
$crawler = self::request('GET', 'app.php/foo/redirect');
|
$crawler = self::request('GET', 'app.php/foo/redirect');
|
||||||
|
|
||||||
$test_redirects = array(
|
$nodes = $crawler->filter('div')->extract(array('id'));
|
||||||
'index.php',
|
|
||||||
'index.php',
|
|
||||||
'tests/index.php',
|
|
||||||
'tests/index.php',
|
|
||||||
'app.php/index',
|
|
||||||
'app.php/index',
|
|
||||||
'app.php/index',
|
|
||||||
'app.php/tests/index',
|
|
||||||
'app.php/tests/index',
|
|
||||||
'app.php/tests/index',
|
|
||||||
'app.php/tests/index',
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($test_redirects as $row_num => $redirect)
|
foreach ($nodes as $redirect)
|
||||||
{
|
{
|
||||||
$this->assertContains($filesystem->clean_path(self::$root_url) . $redirect, $crawler->filter('#redirect_' . $row_num)->text());
|
if (strpos($redirect, 'redirect_expected') !== 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$row_num = str_replace('redirect_expected_', '', $redirect);
|
||||||
|
|
||||||
|
$this->assertContains($filesystem->clean_path(self::$root_url) . $crawler->filter('#redirect_expected_' . $row_num)->text(), $crawler->filter('#redirect_' . $row_num)->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->phpbb_extension_manager->purge('foo/bar');
|
$this->phpbb_extension_manager->purge('foo/bar');
|
||||||
|
|
|
@ -41,23 +41,60 @@ class controller
|
||||||
public function redirect()
|
public function redirect()
|
||||||
{
|
{
|
||||||
$redirects = array(
|
$redirects = array(
|
||||||
|
array(
|
||||||
append_sid($this->root_path . 'index.' . $this->php_ext),
|
append_sid($this->root_path . 'index.' . $this->php_ext),
|
||||||
|
'index.php',
|
||||||
|
),
|
||||||
|
array(
|
||||||
append_sid($this->root_path . '../index.' . $this->php_ext),
|
append_sid($this->root_path . '../index.' . $this->php_ext),
|
||||||
|
'index.php',
|
||||||
|
),
|
||||||
|
array(
|
||||||
append_sid($this->root_path . 'tests/index.' . $this->php_ext),
|
append_sid($this->root_path . 'tests/index.' . $this->php_ext),
|
||||||
|
'tests/index.php',
|
||||||
|
),
|
||||||
|
array(
|
||||||
append_sid($this->root_path . '../tests/index.' . $this->php_ext),
|
append_sid($this->root_path . '../tests/index.' . $this->php_ext),
|
||||||
|
'tests/index.php',
|
||||||
|
),
|
||||||
|
array(
|
||||||
$this->helper->url('index'),
|
$this->helper->url('index'),
|
||||||
|
'app.php/index',
|
||||||
|
),
|
||||||
|
array(
|
||||||
$this->helper->url('../index'),
|
$this->helper->url('../index'),
|
||||||
|
'app.php/index',
|
||||||
|
),
|
||||||
|
array(
|
||||||
$this->helper->url('../../index'),
|
$this->helper->url('../../index'),
|
||||||
|
'app.php/index',
|
||||||
|
),
|
||||||
|
array(
|
||||||
$this->helper->url('tests/index'),
|
$this->helper->url('tests/index'),
|
||||||
|
'app.php/tests/index',
|
||||||
|
),
|
||||||
|
array(
|
||||||
$this->helper->url('../tests/index'),
|
$this->helper->url('../tests/index'),
|
||||||
|
'app.php/tests/index',
|
||||||
|
),
|
||||||
|
array(
|
||||||
$this->helper->url('../../tests/index'),
|
$this->helper->url('../../tests/index'),
|
||||||
|
'app.php/tests/index',
|
||||||
|
),
|
||||||
|
array(
|
||||||
$this->helper->url('../tests/../index'),
|
$this->helper->url('../tests/../index'),
|
||||||
|
'app.php/tests/index',
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($redirects as $redirect)
|
foreach ($redirects as $redirect)
|
||||||
{
|
{
|
||||||
$this->template->assign_block_vars('redirects', array(
|
$this->template->assign_block_vars('redirects', array(
|
||||||
'URL' => redirect($redirect, true),
|
'URL' => redirect($redirect[0], true),
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->template->assign_block_vars('redirects_expected', array(
|
||||||
|
'URL' => $redirect[1],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,7 @@
|
||||||
<!-- BEGIN redirects -->
|
<!-- BEGIN redirects -->
|
||||||
<div id="redirect_{redirects.S_ROW_COUNT}">{redirects.URL}</div>
|
<div id="redirect_{redirects.S_ROW_COUNT}">{redirects.URL}</div>
|
||||||
<!-- END redirects -->
|
<!-- END redirects -->
|
||||||
|
<!-- BEGIN redirects_expected -->
|
||||||
|
<div id="redirect_expected_{redirects_expected.S_ROW_COUNT}">{redirects_expected.URL}</div>
|
||||||
|
<!-- END redirects_expected -->
|
||||||
<!-- INCLUDE overall_footer.html -->
|
<!-- INCLUDE overall_footer.html -->
|
||||||
|
|
Loading…
Add table
Reference in a new issue