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

Detect getMockBuilder #38

Merged
merged 1 commit into from
Jul 2, 2024
Merged

Detect getMockBuilder #38

merged 1 commit into from
Jul 2, 2024

Conversation

ruudk
Copy link
Contributor

@ruudk ruudk commented Jul 2, 2024

It should also detect PHPUnit's \PHPUnit\Framework\TestCase::getMockBuilder.

It should also detect PHPUnit's `\PHPUnit\Framework\TestCase::getMockBuilder`.
@TomasVotruba
Copy link
Member

TomasVotruba commented Jul 2, 2024

How does PHPUnit code with this method look like? Just to verify.

Have you tested it locally?

@ruudk
Copy link
Contributor Author

ruudk commented Jul 2, 2024

$mock = $this->getMockBuilder(FetchMethod::class)
            ->disableOriginalConstructor()
            ->onlyMethods($methods)
            ->getMock();

So that works the same as:

$mock =  $this->createMock(EventRecorder::class);

I did not test it, but I feel this is the same thing.

@ruudk
Copy link
Contributor Author

ruudk commented Jul 2, 2024

I think we should also do the same for createStub. But I don't use that myself.

@TomasVotruba
Copy link
Member

Could you test it locally, please? Otherwise we'll have to add testing suite to make sure these are picked up correctly. Which we might have as well :)

@ruudk
Copy link
Contributor Author

ruudk commented Jul 2, 2024

Ok, I just tested it and it does work perfectly!

@TomasVotruba TomasVotruba merged commit c94c2a0 into rectorphp:main Jul 2, 2024
7 checks passed
@ruudk ruudk deleted the patch-1 branch July 2, 2024 11:59
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

2 participants