fix: not->toHaveKeys() with nested keys (#2094)

This commit is contained in:
Mr PHP
2026-12-03 15:00:01 +01:00
committed by GitHub
parent 8c635c5ba0
commit edb56ae412
4 changed files with 19 additions and 7 deletions
+7 -5
View File
@@ -48,12 +48,14 @@ final readonly class OppositeExpectation
public function toHaveKeys(array $keys): Expectation
{
foreach ($keys as $k => $key) {
if (is_array($key)) {
$this->toHaveKeys(array_keys(Arr::dot($key, $k.'.')));
continue;
}
try {
if (is_array($key)) {
$this->toHaveKeys(array_keys(Arr::dot($key, $k.'.')));
} else {
$this->original->toHaveKey($key);
}
$this->original->toHaveKey($key);
} catch (ExpectationFailedException) {
continue;
}