Add toContainEquals expectation

This commit is contained in:
Erik Gaal
2023-10-03 10:55:57 +02:00
committed by GitHub
parent a8b785f69e
commit 37c40cb735

View File

@ -196,6 +196,21 @@ final class Expectation
return $this;
}
/**
* Asserts that $needle equals an element of the value.
*
* @return self<TValue>
*/
public function toContainEquals(mixed ...$needles): self
{
foreach ($needles as $needle) {
if (! is_iterable($this->value)) {
InvalidExpectationValue::expected('iterable');
}
Assert::assertContainsEquals($needle, $this->value);
}
}
/**
* Asserts that the value starts with $expected.
*