aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functional/fixtures
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2013-11-13 12:03:06 +0100
committerJoas Schilling <nickvergessen@gmx.de>2013-11-13 16:30:20 +0100
commita0fca0acc24684615d123d71ce696e43ba4e2615 (patch)
tree564bb46bed42f8e537d13f02049ded1bfde2b573 /tests/functional/fixtures
parent0aed2816761601ae902159665fdf58932209f772 (diff)
downloadforums-a0fca0acc24684615d123d71ce696e43ba4e2615.tar
forums-a0fca0acc24684615d123d71ce696e43ba4e2615.tar.gz
forums-a0fca0acc24684615d123d71ce696e43ba4e2615.tar.bz2
forums-a0fca0acc24684615d123d71ce696e43ba4e2615.tar.xz
forums-a0fca0acc24684615d123d71ce696e43ba4e2615.zip
[ticket/11997] Add functional test for redirects in controller
PHPBB3-11997
Diffstat (limited to 'tests/functional/fixtures')
-rw-r--r--tests/functional/fixtures/ext/foo/bar/config/routing.yml4
-rw-r--r--tests/functional/fixtures/ext/foo/bar/config/services.yml2
-rw-r--r--tests/functional/fixtures/ext/foo/bar/controller/controller.php30
-rw-r--r--tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/redirect_body.html5
4 files changed, 40 insertions, 1 deletions
diff --git a/tests/functional/fixtures/ext/foo/bar/config/routing.yml b/tests/functional/fixtures/ext/foo/bar/config/routing.yml
index 09a30a8c67..9b1ce3cfd7 100644
--- a/tests/functional/fixtures/ext/foo/bar/config/routing.yml
+++ b/tests/functional/fixtures/ext/foo/bar/config/routing.yml
@@ -13,3 +13,7 @@ foo_template_controller:
foo_exception_controller:
pattern: /foo/exception
defaults: { _controller: foo_bar.controller:exception }
+
+foo_redirect_controller:
+ pattern: /foo/redirect
+ defaults: { _controller: foo_bar.controller:redirect }
diff --git a/tests/functional/fixtures/ext/foo/bar/config/services.yml b/tests/functional/fixtures/ext/foo/bar/config/services.yml
index 3bca4c6567..d7012dee1c 100644
--- a/tests/functional/fixtures/ext/foo/bar/config/services.yml
+++ b/tests/functional/fixtures/ext/foo/bar/config/services.yml
@@ -4,3 +4,5 @@ services:
arguments:
- @controller.helper
- @template
+ - %core.root_path%
+ - %core.php_ext%
diff --git a/tests/functional/fixtures/ext/foo/bar/controller/controller.php b/tests/functional/fixtures/ext/foo/bar/controller/controller.php
index 259d548299..ebb259af2f 100644
--- a/tests/functional/fixtures/ext/foo/bar/controller/controller.php
+++ b/tests/functional/fixtures/ext/foo/bar/controller/controller.php
@@ -8,10 +8,12 @@ class controller
{
protected $template;
- public function __construct(\phpbb\controller\helper $helper, \phpbb\template\template $template)
+ public function __construct(\phpbb\controller\helper $helper, \phpbb\template\template $template, $root_path, $php_ext)
{
$this->template = $template;
$this->helper = $helper;
+ $this->root_path = $root_path;
+ $this->php_ext = $php_ext;
}
public function handle()
@@ -35,4 +37,30 @@ class controller
{
throw new \phpbb\controller\exception('Exception thrown from foo/exception route');
}
+
+ public function redirect()
+ {
+ $redirects = array(
+ append_sid($this->root_path . 'index.' . $this->php_ext),
+ append_sid($this->root_path . '../index.' . $this->php_ext),
+ append_sid($this->root_path . 'tests/index.' . $this->php_ext),
+ append_sid($this->root_path . '../tests/index.' . $this->php_ext),
+ $this->helper->url('index'),
+ $this->helper->url('../index'),
+ $this->helper->url('../../index'),
+ $this->helper->url('tests/index'),
+ $this->helper->url('../tests/index'),
+ $this->helper->url('../../tests/index'),
+ $this->helper->url('../tests/../index'),
+ );
+
+ foreach ($redirects as $redirect)
+ {
+ $this->template->assign_block_vars('redirects', array(
+ 'URL' => redirect($redirect, true),
+ ));
+ }
+
+ return $this->helper->render('redirect_body.html');
+ }
}
diff --git a/tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/redirect_body.html b/tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/redirect_body.html
new file mode 100644
index 0000000000..0c261f10ea
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/bar/styles/prosilver/template/redirect_body.html
@@ -0,0 +1,5 @@
+<!-- INCLUDE overall_header.html -->
+<!-- BEGIN redirects -->
+<div id="redirect_{redirects.S_ROW_COUNT}">{redirects.URL}</div>
+<!-- END redirects -->
+<!-- INCLUDE overall_footer.html -->