Skip to content

Commit

Permalink
fix bug with closure formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Oct 26, 2021
1 parent 2239b02 commit 37217d5
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/Illuminate/Testing/Fluent/Concerns/Matching.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,26 @@ public function whereContains(string $key, $expected)
}

return $actual->containsStrict($search);
})->toArray();

PHPUnit::assertEmpty(
$missing,
sprintf(
'Property [%s] does not contain [%s].',
$key,
implode(', ', array_values($missing))
)
);
});

if ($missing->whereInstanceOf('Closure')->isNotEmpty()) {
PHPUnit::assertEmpty(
$missing->toArray(),
sprintf(
'Property [%s] does not contain a value that passes the truth test within the given closure.',
$key,
)
);
} else {
PHPUnit::assertEmpty(
$missing->toArray(),
sprintf(
'Property [%s] does not contain [%s].',
$key,
implode(', ', array_values($missing->toArray()))
)
);
}

return $this;
}
Expand Down

0 comments on commit 37217d5

Please sign in to comment.