Skip to content
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

Fix return type of mock, partialMock and spy methods in TestCase #362

Merged
merged 6 commits into from
Nov 8, 2019

Conversation

BertvanHoekelen
Copy link
Contributor

This PR add support for the return type of the mock, partialMock and spy methods in Illuminate\Foundation\Testing\TestCase.

Without it you get the following error when calling a method.
Call to an undefined method Mockery\MockInterface::someMethod()

Or when phpstan/phpstan-mockery is installed and you declare it as a property:
Tests\FooTest::$mock (App\Foo&Mockery\MockInterface) does not accept Mockery\MockInterface.

@szepeviktor
Copy link
Collaborator

Thank you for your contribution. And specially for the tests!

Copy link
Collaborator

@canvural canvural left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this!

I just have some remarks about the testing. You can also look to other tests, how we did.

tests/Features/ReturnTypes/TestCaseExtension.php Outdated Show resolved Hide resolved
tests/Features/ReturnTypes/TestCaseExtension.php Outdated Show resolved Hide resolved
tests/Features/ReturnTypes/TestCaseExtension.php Outdated Show resolved Hide resolved
@canvural canvural merged commit db93ccf into larastan:master Nov 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants