diff options
author | Oleg Pudeyev <oleg@bsdpower.com> | 2012-11-15 08:19:40 -0500 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2012-11-15 08:24:27 -0500 |
commit | 4ab178f3efd2ec497081bc1b3e57e4566d2eee6d (patch) | |
tree | 4c333d9363328f626429482c20d3c083265941b1 /tests | |
parent | 8b156c3d837a3a4ae8eac8d1a38df3e5fda150c9 (diff) | |
download | forums-4ab178f3efd2ec497081bc1b3e57e4566d2eee6d.tar forums-4ab178f3efd2ec497081bc1b3e57e4566d2eee6d.tar.gz forums-4ab178f3efd2ec497081bc1b3e57e4566d2eee6d.tar.bz2 forums-4ab178f3efd2ec497081bc1b3e57e4566d2eee6d.tar.xz forums-4ab178f3efd2ec497081bc1b3e57e4566d2eee6d.zip |
[ticket/11202] Add a heuristic function to check for response success.
This tries to account for php sending fatal errors with 200 status code.
PHPBB3-11202
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_framework/phpbb_functional_test_case.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index d35913e415..09f52effec 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -182,7 +182,7 @@ class phpbb_functional_test_case extends phpbb_test_case $login = $this->client->submit($form, array('username' => 'admin', 'password' => 'admin')); $cookies = $this->cookieJar->all(); - + // The session id is stored in a cookie that ends with _sid - we assume there is only one such cookie foreach ($cookies as $cookie); { @@ -229,4 +229,19 @@ class phpbb_functional_test_case extends phpbb_test_case return call_user_func_array('sprintf', $args); } + + /** + * Heuristic function to check that the response is success. + * + * When php decides to die with a fatal error, it still sends 200 OK + * status code. This assertion tries to catch that. + * + * @param string $message Optional failure message + */ + public function assert_response_success($message = null) + { + $this->assertEquals(200, $this->client->getResponse()->getStatus()); + $content = $this->client->getResponse()->getContent(); + $this->assertNotContains('Fatal error:', $content); + } } |