Skip to content

Commit 65f1676

Browse files
committed
[TEST] Populate response body with exception message so that it can be verified
1 parent 563124d commit 65f1676

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/Elasticsearch/Tests/YamlRunnerTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ private function executeTestCase($test, $testFile, $future)
432432
} else {
433433
$this->fail($exception->getMessage());
434434
}
435-
$response = array();
435+
$response = json_decode($exception->getMessage(),true);
436436

437437

438438
} catch (Conflict409Exception $exception) {
@@ -441,15 +441,15 @@ private function executeTestCase($test, $testFile, $future)
441441
} else {
442442
$this->fail($exception->getMessage());
443443
}
444-
$response = array();
444+
$response = json_decode($exception->getMessage(),true);
445445

446446
} catch (Forbidden403Exception $exception) {
447447
if ($expectedError === 'forbidden') {
448448
$this->assertTrue(true);
449449
} else {
450450
$this->fail($exception->getMessage());
451451
}
452-
$response = array();
452+
$response = json_decode($exception->getMessage(),true);
453453

454454
} catch (BadRequest400Exception $exception){
455455
if ($expectedError === 'request') {
@@ -459,7 +459,7 @@ private function executeTestCase($test, $testFile, $future)
459459
} else {
460460
$this->fail($exception->getMessage());
461461
}
462-
$response = array();
462+
$response = json_decode($exception->getMessage(),true);
463463

464464
} catch (ServerErrorResponseException $exception){
465465
if ($expectedError === 'request') {
@@ -469,7 +469,7 @@ private function executeTestCase($test, $testFile, $future)
469469
} else {
470470
$this->fail($exception->getMessage());
471471
}
472-
$response = array();
472+
$response = json_decode($exception->getMessage(),true);
473473

474474
} catch (Elasticsearch\Common\Exceptions\RuntimeException $exception){
475475
if ($expectedError === 'param') {
@@ -479,7 +479,7 @@ private function executeTestCase($test, $testFile, $future)
479479
} else {
480480
$this->fail($exception->getMessage());
481481
}
482-
$response = array();
482+
$response = json_decode($exception->getMessage(),true);
483483

484484
} catch (\Exception $exception) {
485485
if ($expectedError === null) {
@@ -489,7 +489,7 @@ private function executeTestCase($test, $testFile, $future)
489489
} else {
490490
$this->fail($exception->getMessage());
491491
}
492-
$response = array();
492+
$response = json_decode($exception->getMessage(),true);
493493

494494
}
495495

0 commit comments

Comments
 (0)