Skip to content

Commit

Permalink
[TEST] Properly handle 5xx errors when request is being caught
Browse files Browse the repository at this point in the history
  • Loading branch information
polyfractal committed Apr 14, 2014
1 parent 9b85c2d commit d299c61
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/Elasticsearch/Tests/YamlRunnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,16 @@ private function executeTestCase($test, $testFile)
}
$response = array();

} catch (ServerErrorResponseException $exception){
if ($expectedError === 'request') {
$this->assertTrue(true);
} elseif (isset($expectedError) === true && preg_match("/$expectedError/", $exception->getMessage()) === 1) {
$this->assertTrue(true);
} else {
$this->fail($exception->getMessage());
}
$response = array();

} catch (Elasticsearch\Common\Exceptions\RuntimeException $exception){
if ($expectedError === 'param') {
$this->assertTrue(true);
Expand Down

0 comments on commit d299c61

Please sign in to comment.