You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Working on implementing unit tests for a piece of code that uses a PSR-18 client I was unable to have a \Psr\Http\Client\ClientInterface::sendRequest() MethodProphecy to throw one of the expected exception interface. To reproduce:
Since \Psr\Http\Client\ClientExceptionInterface extends \Throwable this should work. But it doesn't:
Prophecy\Exception\InvalidArgumentException : Exception / Throwable class or instance expected as argument to ThrowPromise, but got Psr\Http\Client\ClientExceptionInterface.
This scenario is reproducible on the latest stable version 1.8.0 and on the master branch.
The text was updated successfully, but these errors were encountered:
- add additional check for existence of interface in contructor
- change `is_subclass_of` to `is_a` to allow for `Throwable` and subclasses of `Throwable`
- add specs for cases of `Throwable` and extensions of `Throwable`
To maintain support for php 5.3 the new specs are only applicable for PHP 7.0 and higher and `ThrowPromise::isValidThrowable()` checks for both `Exception` and `Throwable`.
fixesphpspec#428
Working on implementing unit tests for a piece of code that uses a PSR-18 client I was unable to have a
\Psr\Http\Client\ClientInterface::sendRequest()
MethodProphecy to throw one of the expected exception interface. To reproduce:Since
\Psr\Http\Client\ClientExceptionInterface
extends\Throwable
this should work. But it doesn't:This scenario is reproducible on the latest stable version
1.8.0
and on themaster
branch.The text was updated successfully, but these errors were encountered: