mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
add new expectation
This commit is contained in:
@ -799,6 +799,22 @@ final class Expectation
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param class-string $class
|
||||
*
|
||||
* @return Expectation<TValue>
|
||||
*/
|
||||
public function toContainOnlyInstancesOf(string $class): Expectation
|
||||
{
|
||||
if (!is_iterable($this->value)) {
|
||||
InvalidExpectationValue::expected('iterable');
|
||||
}
|
||||
|
||||
Assert::assertContainsOnlyInstancesOf($class, $this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that executing value throws an exception.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user