-
Notifications
You must be signed in to change notification settings - Fork 48
Add a custom expression resolver for type specification #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You should write your own type-specifying extensions similar to those in
phpstan-phpunit. No need to extend the ones here, implement the interface
with your own class that does not extend anything.
On Wed, 27 Mar 2019 at 18:12, Johann Pardanaud ***@***.***> wrote:
I've create some assertion methods, including those:
assertResponseIsRedirect(Response $response, string $message = ''): voidassertRedirectResponseIsPermanent(RedirectResponse $response, string $message = ''): void
If I create a functional test making a request with Symfony, I want to
check if the response
<https://github.com/symfony/symfony/blob/fdb0490a168202b4d33053f4f05c766fb4414dd6/src/Symfony/Component/HttpKernel/Client.php#L29>
is a redirect (with instanceof in my assertion method) and then I want to
check if the redirection is permanent:
$response = $this->client->getResponse();self::assertResponseIsRedirect($response);self::assertRedirectResponseIsPermanent($response);
If I run PHPStan, I get the following error:
Parameter #1 $response of static method Path\To\TestCase::assertRedirectResponseIsPermanent() expects Symfony\Component\HttpFoundation\RedirectResponse, Symfony\Component\HttpFoundation\Response given.
Is there any way to add a custom expression resolver to
AssertTypeSpecifyingExtensionHelper
<https://github.com/phpstan/phpstan-phpunit/blob/ec9408e03859f9c775663c14687a7d106e17c751/src/Type/PHPUnit/Assert/AssertTypeSpecifyingExtensionHelper.php>
so I can get rid of this error?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#44>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGZuEoUN_rsFcysXNuKPXeWXD0chw8Sks5va6ZpgaJpZM4cOVwi>
.
--
Ondřej Mirtes
|
Great, thank you! 🙂 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I've create some assertion methods, including those:
If I create a functional test making a request with Symfony, I want to check if the response is a redirect (with
instanceof
in my assertion method) and then I want to check if the redirection is permanent:If I run PHPStan, I get the following error:
Is there any way to add a custom expression resolver to AssertTypeSpecifyingExtensionHelper so I can get rid of this error?
The text was updated successfully, but these errors were encountered: