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

[PHPUnit 9.1] Migrate PHPUnit test class from built-in Prophecy integration to trait #3099

Closed
sebastianbergmann opened this issue Mar 29, 2020 · 2 comments · Fixed by #3117
Closed
Assignees

Comments

@sebastianbergmann
Copy link

The tight integration of Prophecy into PHPUnit is deprecated in PHPUnit 9.1 and will be removed in PHPUnit 10.

A rector would be nice that looks for classes that extend PHPUnit\Framework\TestCase and call $this->prophesize(). The class needs to be changed to use the Prophecy\PhpUnit\ProphecyTrait trait:

 use PHPUnit\Framework\TestCase;
+use Prophecy\PhpUnit\ProphecyTrait;
 
final class ExampleTest extends TestCase
 {
+    use ProphecyTrait;
+
     public function testOne(): void
     {
         $prophecy = $this->prophesize(\AnInterface::class);
@TomasVotruba TomasVotruba changed the title Migrate PHPUnit test class from built-in Prophecy integration to trait [PHPUnit 9.1] Migrate PHPUnit test class from built-in Prophecy integration to trait Mar 31, 2020
@TomasVotruba
Copy link
Member

I'll look on it this week. Thanks for clear diff!

@TomasVotruba
Copy link
Member

Done: #3117

TomasVotruba added a commit that referenced this issue Nov 26, 2022
rectorphp/rector-src@07b529a [BetterPhpDocParser] Call phpdocInfo->markAsChanged() on change param/return type on PhpDocTypeChanger (#3099)
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 a pull request may close this issue.

2 participants