mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
[feature/controller] Add test for missing argument in controller class
PHPBB3-10864
This commit is contained in:
parent
230897723c
commit
0c75d3d7da
4 changed files with 19 additions and 2 deletions
|
@ -91,7 +91,15 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
|
|||
$this->phpbb_extension_manager->enable('foo/bar');
|
||||
$crawler = $this->request('GET', 'app.php/foo/bar');
|
||||
$this->assertContains("foo/bar controller handle() method", $crawler->filter('body')->text());
|
||||
$this->phpbb_extension_manager->purge('foobar');
|
||||
$this->phpbb_extension_manager->purge('foo/bar');
|
||||
}
|
||||
|
||||
public function test_missing_argument()
|
||||
{
|
||||
$this->phpbb_extension_manager->enable('foo/bar');
|
||||
$crawler = $this->request('GET', 'app.php/foo/baz');
|
||||
$this->assertContains('Missing value for argument #1: test in class phpbb_ext_foo_bar_controller:baz', $crawler->filter('body')->text());
|
||||
$this->phpbb_extension_manager->purge('foo/bar');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
foo_bar_controller:
|
||||
pattern: /foo/bar
|
||||
defaults: { _controller: foo_bar.controller:handle }
|
||||
|
||||
foo_baz_controller:
|
||||
pattern: /foo/baz
|
||||
defaults: { _controller: foo_bar.controller:baz }
|
||||
|
|
|
@ -7,4 +7,9 @@ class phpbb_ext_foo_bar_controller
|
|||
{
|
||||
return new Response('foo/bar controller handle() method', 200);
|
||||
}
|
||||
|
||||
public function baz($test)
|
||||
{
|
||||
return new Response('Value of "test" URL argument is: ' . $test);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
class phpbb_ext_foobar_ext extends phpbb_extension_base
|
||||
class phpbb_ext_foo_bar_ext extends phpbb_extension_base
|
||||
{
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue