mirror of
https://github.com/pestphp/pest.git
synced 2026-03-09 17:27:22 +01:00
feat(expect): handle property calls to opposite expectations
This commit is contained in:
@ -42,4 +42,19 @@ final class OppositeExpectation
|
||||
|
||||
throw new ExpectationFailedException(sprintf('@todo'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle dynamic properties gets into the original expectation.
|
||||
*/
|
||||
public function __get(string $name): Expectation
|
||||
{
|
||||
try {
|
||||
/* @phpstan-ignore-next-line */
|
||||
$this->original->{$name};
|
||||
} catch (ExpectationFailedException $e) {
|
||||
return $this->original;
|
||||
}
|
||||
|
||||
throw new ExpectationFailedException(sprintf('@todo'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user