Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[PhpUnitBridge] Inject polyfills in TestCase#32882

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@jderusse
Copy link
Member

@jderussejderusse commentedAug 2, 2019
edited
Loading

QA
Branch?4.4
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?not yet
Fixed tickets#32844
LicenseMIT
Doc PRNA

This PR replace the previous traitForwardCompatTestTrait by injecting forward compatibility code in phpunit itself which allow to use the polyfill methods in tests without changing the code.

when usingsimple_phpunit the env variable$PHPUNIT_REMOVE_RETURN_TYPEHINT=1 (default 0) removes the: void typehint in public and protected methods (allow to use 7.4 8 in 3.4 branch)

note: once merged, all tests have to be fixed. see#32889

@jderussejderusseforce-pushed theinject-forward-compat branch 2 times, most recently from588b4eb to1874dc2CompareAugust 2, 2019 21:14
@nicolas-grekasnicolas-grekas added this to thenext milestoneAug 2, 2019
@jderussejderusse changed the title[PhpUnitBridge] Inject ForwardCompatibiliy in TestCaseWIP [PhpUnitBridge] Inject ForwardCompatibiliy in TestCaseAug 3, 2019
nicolas-grekas added a commit that referenced this pull requestAug 3, 2019
…las-grekas)This PR was merged into the 3.4 branch.Discussion----------[PhpUnitBridge] Use PHPUnit75Migration in CS fixer| Q             | A| ------------- | ---| Branch?       | 4.4| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes (not yet) need#32882,#32886,#32893| Fixed tickets |#32844| License       | MIT| Doc PR        | NABump php-cs-fixer rule to PHPUnit75Migration:risky which add- php_unit_dedicate_assert_internal_type- php_unit_expectation- php_unit_mock- php_unit_no_expectation_annotationwhich are (or will be) all polyfillyed- [x] need to polyfill `createPartialMock`Commits-------9fb1c42 Adopt `@PHPUnit55Migration:risky` rule of php-cs-fixer
@jderussejderusseforce-pushed theinject-forward-compat branch 5 times, most recently from203c4f6 tof15d762CompareAugust 3, 2019 16:55
* file that was distributed with this source code.
*/

namespaceSymfony\Bridge\PhpUnit;
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This file is temporary and will be remove before merging

@jderussejderusse changed the titleWIP [PhpUnitBridge] Inject ForwardCompatibiliy in TestCase[PhpUnitBridge] Inject ForwardCompatibiliy in TestCaseAug 3, 2019
@jderusse
Copy link
MemberAuthor

this pr is RFR. test on#32889 are green.

@jderussejderusseforce-pushed theinject-forward-compat branch 2 times, most recently fromb7d9d95 tod28843dCompareAugust 3, 2019 17:41
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

Really really cool :)
Just some nit picking.

jderusse reacted with heart emoji
@nicolas-grekasnicolas-grekas mentioned this pull requestAug 3, 2019
23 tasks
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

Really great!

@nicolas-grekas
Copy link
Member

Thank you@jderusse.

@nicolas-grekasnicolas-grekas merged commit016bd8d intosymfony:4.4Aug 3, 2019
nicolas-grekas added a commit that referenced this pull requestAug 3, 2019
…jderusse)This PR was merged into the 4.4 branch.Discussion----------[PhpUnitBridge] Inject ForwardCompatibiliy in TestCase| Q             | A| ------------- | ---| Branch?       | 4.4| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | not yet| Fixed tickets |#32844| License       | MIT| Doc PR        | NAThis PR replace the previous trait `ForwardCompatTestTrait` by injecting forward compatibility code in phpunit itself which allow to use the polyfill methods in tests without changing the code.when using `simple_phpunit` the env variable  `$PHPUNIT_REMOVE_RETURN_TYPEHINT=1` (default 0) removes the `: void` typehint in public and protected methods (allow to use 7.4 8 in 3.4 branch)note: once merged, all tests have to be fixed. see#32889Commits-------016bd8d Inject ForwardCompatibiliy in TestCase
nicolas-grekas added a commit that referenced this pull requestAug 3, 2019
This PR was merged into the 3.4 branch.Discussion----------[PhpUnitBridge] Remove use of ForwardCompatTrait| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#32844| License       | MIT| Doc PR        | NAWith#32882 the ForwardCompatibilityTrait is injected in TestCase which now act as a true polyfillCommits-------ac6242f Remove use of ForwardCompatTrait
@nicolas-grekasnicolas-grekas changed the title[PhpUnitBridge] Inject ForwardCompatibiliy in TestCase[PhpUnitBridge] Inject polyfills in TestCaseAug 4, 2019
fabpot added a commit that referenced this pull requestAug 5, 2019
…newest PHPUnit features (nicolas-grekas)This PR was merged into the 4.4 branch.Discussion----------[PhpUnitBridge] make the bridge act as a polyfill for newest PHPUnit features| Q             | A| ------------- | ---| Branch?       | 4.4| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -It's been quite a tunnel these days with@jderusse but here we are: the phpunit-bridge is now a fully working polyfill for newest PHPUnit features. All related PRs have been merged as "minor" but they are now ready for prime time, hence this PR that I'd like to be merged as "feature", to make it part of the changelog of Symfony 4.4.As of version 4.4, the `simple-phpunit` script will run an augmented version of PHPUnit, that will provide the newest assertions of PHPUnit 8 even if you happen to be running PHPUnit 4.8+ (because you still need to test on PHP 5.5, as Symfony does.)The bridge currently provides polyfills for the methods that are needed to make our tests pass on PHP 7.4 with no deprecations:-#32878#32907 `assertString(Not)ContainsString(IgnoringCase)`, `assertEqualsWithDelta` and `assert(Not)ContainsEquals`-#32875 `expectException*`, which replace `@expectedException*` annotations-#32846 `assertIs*`, which replace `assertInternalType`-#32865 `create(Partial)Mock`-#32931 `assert(File|Directory)(Not)(Exists|IsReadable|IsWritable)`More polyfills might be added if you need them. PRs welcome as usual.As of#32882, when the `SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT` is set to `1`, `simple-phpunit` will also [patch](https://github.com/symfony/symfony/blob/884669b83b131df8c3c41ad6517abe8cff7903b0/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php#L149) the source of PHPUnit 8 to remove the `void` return-type on `setUp*`/`tearDown*`. This is required when the same codebase must be tested against PHP 5.5 up to 7.4+ (as does our branch 3.4). For codebases that don't want or can't run their tests with `simple-phpunit` but want to run their PHP 5.5 tests with PHPUnit 8, the bridge provides a new `SetUpTearDownTrait` that allows a [smooth transition](https://github.com/php-cache/integration-tests/blob/c59a4d2dec1e462e5f5646e5fe102f403d6b8903/src/CachePoolTest.php#L21) to it.Along the path, we also created a new tool for our CI: it's now possible to submit a new polyfill on the current feature-branch (4.4 these days) and test it with a PR on another branch. See#32887 for the patch.All these new features have been added to achieve PHP 7.4 support on branch 3.4. There are still many deprecations that need to be fixed, all tracked in#32844. It should be a pretty nice list of "good first issues". Thank you@luispabon,@tweichart,@Alexander1000 BTW.A big specific thank you to@jderusse for the help!Let's rock PHP 7.4, can't wait for your PRs, see you on#32844 :)Commits-------271211b [PhpUnitBridge] make the bridge act as a polyfill for newest PHPUnit features
@jderussejderusse deleted the inject-forward-compat branchAugust 8, 2019 11:36
@nicolas-grekasnicolas-grekas modified the milestones:next,4.4Oct 27, 2019
hultberg pushed a commit to hultberg/symfony that referenced this pull requestSep 17, 2021
…(jderusse)This PR was merged into the 3.4 branch.Discussion----------[PhpUnitBridge] Remove use of ForwardCompatTrait| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |symfony#32844| License       | MIT| Doc PR        | NAWithsymfony#32882 the ForwardCompatibilityTrait is injected in TestCase which now act as a true polyfillCommits-------ac6242f Remove use of ForwardCompatTrait
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@lyrixxlyrixxAwaiting requested review from lyrixx

@xabbuhxabbuhAwaiting requested review from xabbuh

@dunglasdunglasAwaiting requested review from dunglas

@srozesrozeAwaiting requested review from sroze

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

3 participants

@jderusse@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp