From 9df055b316c72aa6dfe6ae2c8a6ef40e61f93576 Mon Sep 17 00:00:00 2001 From: Zachary Tong Date: Fri, 16 Sep 2016 12:17:59 -0400 Subject: [PATCH] [TEST] Better context to true/false failures --- tests/Elasticsearch/Tests/YamlRunnerTest.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/Elasticsearch/Tests/YamlRunnerTest.php b/tests/Elasticsearch/Tests/YamlRunnerTest.php index 900047e29..1c54cf225 100644 --- a/tests/Elasticsearch/Tests/YamlRunnerTest.php +++ b/tests/Elasticsearch/Tests/YamlRunnerTest.php @@ -377,8 +377,11 @@ public function executeAsyncExistRequest($caller, $method, $endpointParams, $exp */ public function operationIsFalse($operation, $lastOperationResult, &$context, $testName) { - $msg = "Failed to assert that a value is false in test \"$testName\"\n".var_export($lastOperationResult, true); - static::assertFalse((bool)$this->resolveValue($lastOperationResult, $operation, $context), $msg); + $value = (bool)$this->resolveValue($lastOperationResult, $operation, $context); + $msg = "Failed to assert that a value is false in test \"$testName\"\n" + ."$operation was [$value]" + .var_export($lastOperationResult, true); + static::assertFalse($value, $msg); return $lastOperationResult; } @@ -394,7 +397,9 @@ public function operationIsTrue($operation, $lastOperationResult, &$context, $te { $value = $this->resolveValue($lastOperationResult, $operation, $context); - $msg = "Failed to assert that a value is true in test \"$testName\"\n".var_export($lastOperationResult, true); + $msg = "Failed to assert that a value is true in test \"$testName\"\n" + ."$operation was [$value]" + .var_export($lastOperationResult, true); static::assertNotEquals(0, $value, $msg); static::assertNotFalse($value, $msg); static::assertNotNull($value, $msg);