aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functional
diff options
context:
space:
mode:
authorDavid King <imkingdavid@gmail.com>2012-11-16 10:30:50 -0500
committerDavid King <imkingdavid@gmail.com>2012-11-16 17:05:57 -0500
commit0c75d3d7da9c5fd7ee1560597db684c9d1704c22 (patch)
treeb7d279dee2e0edc9285decd1fbfefcf451bb027e /tests/functional
parent230897723c9e5fc5534d9781b04ffd8dac70d51b (diff)
downloadforums-0c75d3d7da9c5fd7ee1560597db684c9d1704c22.tar
forums-0c75d3d7da9c5fd7ee1560597db684c9d1704c22.tar.gz
forums-0c75d3d7da9c5fd7ee1560597db684c9d1704c22.tar.bz2
forums-0c75d3d7da9c5fd7ee1560597db684c9d1704c22.tar.xz
forums-0c75d3d7da9c5fd7ee1560597db684c9d1704c22.zip
[feature/controller] Add test for missing argument in controller class
PHPBB3-10864
Diffstat (limited to 'tests/functional')
-rw-r--r--tests/functional/extension_controller_test.php10
-rwxr-xr-xtests/functional/fixtures/ext/foo/bar/config/routing.yml4
-rwxr-xr-xtests/functional/fixtures/ext/foo/bar/controller/controller.php5
-rwxr-xr-xtests/functional/fixtures/ext/foo/bar/ext.php2
4 files changed, 19 insertions, 2 deletions
diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php
index 2f07c8a70f..b1e910aeac 100644
--- a/tests/functional/extension_controller_test.php
+++ b/tests/functional/extension_controller_test.php
@@ -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');
}
/**
diff --git a/tests/functional/fixtures/ext/foo/bar/config/routing.yml b/tests/functional/fixtures/ext/foo/bar/config/routing.yml
index 7ecaba9e71..945ef51366 100755
--- a/tests/functional/fixtures/ext/foo/bar/config/routing.yml
+++ b/tests/functional/fixtures/ext/foo/bar/config/routing.yml
@@ -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 }
diff --git a/tests/functional/fixtures/ext/foo/bar/controller/controller.php b/tests/functional/fixtures/ext/foo/bar/controller/controller.php
index 4c5274951f..def5184e8c 100755
--- a/tests/functional/fixtures/ext/foo/bar/controller/controller.php
+++ b/tests/functional/fixtures/ext/foo/bar/controller/controller.php
@@ -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);
+ }
}
diff --git a/tests/functional/fixtures/ext/foo/bar/ext.php b/tests/functional/fixtures/ext/foo/bar/ext.php
index b50f95990e..7170209d53 100755
--- a/tests/functional/fixtures/ext/foo/bar/ext.php
+++ b/tests/functional/fixtures/ext/foo/bar/ext.php
@@ -1,6 +1,6 @@
<?php
-class phpbb_ext_foobar_ext extends phpbb_extension_base
+class phpbb_ext_foo_bar_ext extends phpbb_extension_base
{
}