aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functional/extension_controller_test.php
diff options
context:
space:
mode:
authorDavid King <imkingdavid@gmail.com>2012-11-19 12:37:20 -0500
committerDavid King <imkingdavid@gmail.com>2012-11-19 12:37:20 -0500
commitf8614bfc84ba9b9cc814b8f78e343005620f18f8 (patch)
tree2bc656eecad6052aa04134c4506ab10876d6fe63 /tests/functional/extension_controller_test.php
parent30043502814cd42d824dc1d6bcb25bebc60adbed (diff)
downloadforums-f8614bfc84ba9b9cc814b8f78e343005620f18f8.tar
forums-f8614bfc84ba9b9cc814b8f78e343005620f18f8.tar.gz
forums-f8614bfc84ba9b9cc814b8f78e343005620f18f8.tar.bz2
forums-f8614bfc84ba9b9cc814b8f78e343005620f18f8.tar.xz
forums-f8614bfc84ba9b9cc814b8f78e343005620f18f8.zip
[feature/controller] Check for proper status codes from controllers
PHPBB3-10864
Diffstat (limited to 'tests/functional/extension_controller_test.php')
-rw-r--r--tests/functional/extension_controller_test.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php
index 482fe9dfd3..c7b585354e 100644
--- a/tests/functional/extension_controller_test.php
+++ b/tests/functional/extension_controller_test.php
@@ -116,11 +116,20 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
{
$this->phpbb_extension_manager->enable('foo/bar');
$crawler = $this->request('GET', 'app.php?controller=foo/baz');
- $this->assertEquals(404, $this->client->getResponse()->getStatus());
+ $this->assertEquals(500, $this->client->getResponse()->getStatus());
$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');
}
+ public function test_exception_thrown_status_code()
+ {
+ $this->phpbb_extension_manager->enable('foo/bar');
+ $crawler = $this->request('GET', 'app.php?controller=foo/exception');
+ $this->assertEquals(500, $this->client->getResponse()->getStatus());
+ $this->assertContains('Exception thrown from foo/exception route', $crawler->filter('body')->text());
+ $this->phpbb_extension_manager->purge('foo/bar');
+ }
+
/**
* Check the error produced by extension at ./ext/does/not/exist.
*
@@ -133,6 +142,8 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
public function test_error_ext_disabled_or_404()
{
$crawler = $this->request('GET', 'app.php?controller=does/not/exist');
+ // This is 500 response because the exception is thrown from within Symfony
+ // and does not provide a exception code, so we assign it 500 by default
$this->assertEquals(404, $this->client->getResponse()->getStatus());
$this->assertContains('No route found for "GET /does/not/exist"', $crawler->filter('body')->text());
}