Skip to content

Commit

Permalink
feat: update ci vendor/bin/phpunit
Browse files Browse the repository at this point in the history
  • Loading branch information
Yozhef committed Aug 12, 2021
1 parent 740e838 commit 698d93b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/Context/Traits/ArraySimilarTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@ protected function isArraysSimilar(array $expected, array $actual, array $variab
return false;
}

foreach ($expected as $k => $v) {
if (!isset($actual[$k]) && $v !== null) {
foreach ($expected as $key => $value) {
if (!isset($actual[$key]) && $value !== null) {
return false;
}

if (gettype($expected[$k]) !== gettype($actual[$k]) && !in_array($k, $variableFields)) {
if (gettype($value) !== gettype($actual[$key]) && !in_array($key, $variableFields)) {
return false;
}

if (is_array($v)) {
if (!$this->isArraysSimilar($expected[$k], $actual[$k], $variableFields)) {
if (is_array($value)) {
if (!$this->isArraysSimilar($value, $actual[$key], $variableFields)) {
return false;
}
} elseif (!in_array($k, $variableFields, true) && ($actual[$k] !== $expected[$k])) {
} elseif (!in_array($key, $variableFields, true) && ($actual[$key] !== $value)) {
return false;
} elseif (in_array($k, $variableFields, true)) {
} elseif (in_array($key, $variableFields, true)) {
if (
is_string($expected[$k]) && strpos($expected[$k], '~') === 0
&& !preg_match(sprintf('|%s|', substr($expected[$k], 1)), $actual[$k])
is_string($value) && strpos($value, '~') === 0
&& !preg_match(sprintf('|%s|', substr($value, 1)), $actual[$key])
) {
return false;
}
Expand Down

0 comments on commit 698d93b

Please sign in to comment.