Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged

Conversation

alexandre-daubois
Copy link
Member

Q A
Branch? 5.4
Bug fix? yes-ish
New feature? no
Deprecations? no
Tickets Continuing #48668 (comment)
License MIT
Doc PR NA

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:: to self:: calls, as pointed out by Nicolas in this comment: #49244 (comment)

cc @OskarStark πŸ‘‹

@alexandre-daubois alexandre-daubois force-pushed the migrate-data-providers branch 5 times, most recently from 853ec6d to 1e9e03c Compare February 8, 2023 08:50
@nicolas-grekas
Copy link
Member

Thank you @alexandre-daubois.

@nicolas-grekas nicolas-grekas merged commit 59f2eba into symfony:5.4 Feb 10, 2023
@alexandre-daubois alexandre-daubois deleted the migrate-data-providers branch February 10, 2023 13:21
}

/**
* @return MockObject<DumpDataCollector>
Copy link
Member

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());
Copy link
Member

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 ?

Copy link
Member Author

@alexandre-daubois alexandre-daubois Feb 10, 2023

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 πŸ‘

nicolas-grekas added a commit that referenced this pull request Feb 10, 2023
…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); })))];
Copy link
Member

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?

Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants