feat(expect): handle property calls to opposite expectations

This commit is contained in:
Nuno Maduro
2020-07-15 01:05:36 +02:00
parent 2751bc9674
commit 1e61144cd2
4 changed files with 31 additions and 3 deletions

View File

@ -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'));
}
}