Skip to content

A free open source IT asset/license management system

Add help text to response assertion helpers

Marcus Moore04661d5441b0
diff --git a/tests/Support/CustomTestMacros.php b/tests/Support/CustomTestMacros.php
index 8a0b308c71..4242b28653 100644
--- a/tests/Support/CustomTestMacros.php
+++ b/tests/Support/CustomTestMacros.php
@@ -24,7 +24,10 @@ trait CustomTestMacros
function (Model $model, string $property = 'name') use ($guardAgainstNullProperty) {
$guardAgainstNullProperty($model, $property);
- Assert::assertTrue(collect($this['rows'])->pluck($property)->contains(e($model->{$property})));
+ Assert::assertTrue(
+ collect($this['rows'])->pluck($property)->contains(e($model->{$property})),
+ "Response did not contain the expected value: {$model->{$property}}"
+ );
return $this;
}
@@ -35,7 +38,10 @@ trait CustomTestMacros
function (Model $model, string $property = 'name') use ($guardAgainstNullProperty) {
$guardAgainstNullProperty($model, $property);
- Assert::assertFalse(collect($this['rows'])->pluck($property)->contains(e($model->{$property})));
+ Assert::assertFalse(
+ collect($this['rows'])->pluck($property)->contains(e($model->{$property})),
+ "Response contained unexpected value: {$model->{$property}}"
+ );
return $this;
}
@@ -46,7 +52,10 @@ trait CustomTestMacros
function (Model $model, string $property = 'id') use ($guardAgainstNullProperty) {
$guardAgainstNullProperty($model, $property);
- Assert::assertTrue(collect($this->json('results'))->pluck('id')->contains(e($model->{$property})));
+ Assert::assertTrue(
+ collect($this->json('results'))->pluck('id')->contains(e($model->{$property})),
+ "Response did not contain the expected value: {$model->{$property}}"
+ );
return $this;
}
@@ -57,7 +66,10 @@ trait CustomTestMacros
function (Model $model, string $property = 'id') use ($guardAgainstNullProperty) {
$guardAgainstNullProperty($model, $property);
- Assert::assertFalse(collect($this->json('results'))->pluck('id')->contains(e($model->{$property})));
+ Assert::assertFalse(
+ collect($this->json('results'))->pluck('id')->contains(e($model->{$property})),
+ "Response contained unexpected value: {$model->{$property}}"
+ );
return $this;
}