1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

[feature/controller] Add controller functional test with template

PHPBB3-10864
This commit is contained in:
David King
2012-11-16 11:41:05 -05:00
parent ba1acdca03
commit 5b013ddf5c
5 changed files with 52 additions and 5 deletions

View File

@@ -5,3 +5,7 @@ foo_bar_controller:
foo_baz_controller:
pattern: /foo/baz
defaults: { _controller: foo_bar.controller:baz }
foo_template_controller:
pattern: /foo/template
defaults: { _controller: foo_bar.controller:template }

View File

@@ -1,3 +1,6 @@
services:
foo_bar.controller:
class: phpbb_ext_foo_bar_controller
arguments:
- @controller.helper
- @template

View File

@@ -3,6 +3,14 @@ use Symfony\Component\HttpFoundation\Response;
class phpbb_ext_foo_bar_controller
{
protected $template;
public function __construct(phpbb_controller_helper $helper, phpbb_template $template)
{
$this->template = $template;
$this->helper = $helper;
}
public function handle()
{
return new Response('foo/bar controller handle() method', 200);
@@ -12,4 +20,11 @@ class phpbb_ext_foo_bar_controller
{
return new Response('Value of "test" URL argument is: ' . $test);
}
public function template()
{
$this->template->assign_var('A_VARIABLE', 'I am a variable');
return $this->helper->render('foo_bar_body.html');
}
}

View File

@@ -0,0 +1,3 @@
<!-- INCLUDE overall_header.html -->
<div id="content">{A_VARIABLE}</div>
<!-- INCLUDE overall_footer.html -->