-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Tests] Migrate tests to static data providers #49288
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
[Tests] Migrate tests to static data providers #49288
Conversation
e5ad6fc
to
3d6d42d
Compare
3d6d42d
to
15b962e
Compare
src/Symfony/Component/Lock/Tests/Store/MongoDbStoreFactoryTest.php
Outdated
Show resolved
Hide resolved
853ec6d
to
1e9e03c
Compare
1e9e03c
to
3b8b070
Compare
Thank you @alexandre-daubois. |
} | ||
|
||
/** | ||
* @return MockObject<DumpDataCollector> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The right type here is MockObject&DumpDataCollector
actually. PHPUnit does not make the MockObject interface generic.
} | ||
|
||
public static function getDescribeApplicationTestData() | ||
{ | ||
return static::getDescriptionTestData(ObjectsProvider::getApplications()); | ||
return self::getDescriptionTestData(ObjectsProvider::getApplications()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getDescriptionTestData
is protected, but switching to self::
makes it ignore any override of the method. Is it expected ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't. It works here because the method is currently not overridden. But it would definitely cause some problems if it's overridden one day. I addressed both your comments in #49328, thank you very much for letting me know! I'll be cautious next time with this π
β¦dre-daubois) This PR was merged into the 5.4 branch. Discussion ---------- [Tests] Fix static calls and Mock var annotation | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Addresses `@stof` review of #49288 | License | MIT | Doc PR | _NA_ Commits ------- 5b40b98 [Tests] Fix static calls and Mock var annotation
{ | ||
// no password upgrade badge | ||
yield [$this->createEvent(new SelfValidatingPassport(new UserBadge('test', function () { return $this->createMock(UserInterface::class); })))]; | ||
yield [self::createEvent(new SelfValidatingPassport(new UserBadge('test', function () { return $this->createMock(UserInterface::class); })))]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this still uses $this, can you please send a PR to fix it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok no, I'm going to borrow from the line below
This is yet another PR to continue the manual work needed for the migration of data providers to static ones.
I also took the opportunity to pass a few
static::
toself::
calls, as pointed out by Nicolas in this comment: #49244 (comment)cc @OskarStark π