Skip to content

Commit

Permalink
[TEST] Better context to true/false failures
Browse files Browse the repository at this point in the history
  • Loading branch information
polyfractal committed Sep 16, 2016
1 parent aa93f39 commit 9df055b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/Elasticsearch/Tests/YamlRunnerTest.php
Expand Up @@ -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;
}
Expand All @@ -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);
Expand Down

0 comments on commit 9df055b

Please sign in to comment.