Skip to content

Commit 9df055b

Browse files
committed
[TEST] Better context to true/false failures
1 parent aa93f39 commit 9df055b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/Elasticsearch/Tests/YamlRunnerTest.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,11 @@ public function executeAsyncExistRequest($caller, $method, $endpointParams, $exp
377377
*/
378378
public function operationIsFalse($operation, $lastOperationResult, &$context, $testName)
379379
{
380-
$msg = "Failed to assert that a value is false in test \"$testName\"\n".var_export($lastOperationResult, true);
381-
static::assertFalse((bool)$this->resolveValue($lastOperationResult, $operation, $context), $msg);
380+
$value = (bool)$this->resolveValue($lastOperationResult, $operation, $context);
381+
$msg = "Failed to assert that a value is false in test \"$testName\"\n"
382+
."$operation was [$value]"
383+
.var_export($lastOperationResult, true);
384+
static::assertFalse($value, $msg);
382385

383386
return $lastOperationResult;
384387
}
@@ -394,7 +397,9 @@ public function operationIsTrue($operation, $lastOperationResult, &$context, $te
394397
{
395398
$value = $this->resolveValue($lastOperationResult, $operation, $context);
396399

397-
$msg = "Failed to assert that a value is true in test \"$testName\"\n".var_export($lastOperationResult, true);
400+
$msg = "Failed to assert that a value is true in test \"$testName\"\n"
401+
."$operation was [$value]"
402+
.var_export($lastOperationResult, true);
398403
static::assertNotEquals(0, $value, $msg);
399404
static::assertNotFalse($value, $msg);
400405
static::assertNotNull($value, $msg);

0 commit comments

Comments
 (0)