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

[PhpUnitBridge] added polyfill for assertStringContainsString*() #32878

Merged

Conversation

tweichart
Copy link

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #32844
License MIT
Doc PR -

this PR provides a polyfill for methods assertStringContainsString and assertStringContainsStringIgnoringCase in preparation for the PHPUnit 9 deprecations.
PR follows the pattern of this PR, hence the PR to master

@tweichart
Copy link
Author

tweichart commented Aug 2, 2019

@nicolas-grekas I'm not entirely sure about the PR going into master, I just want to add the polyfills so I can start on replacing the assertString calls with string haystacks... which branches does this commit need to be added to or is master sufficient?

@tweichart tweichart changed the title added polyfill for assertStringContainsString and assertStringContain… [PhpUnitBridge] Add polyfill for assertStringContainsString* Aug 2, 2019
@tweichart tweichart force-pushed the polyfill-phpunit-assertstring branch 2 times, most recently from cda3009 to b1472d0 Compare August 2, 2019 08:43
@nicolas-grekas nicolas-grekas added this to the next milestone Aug 2, 2019
@nicolas-grekas
Copy link
Member

Thank you @tweichart
I didn't reply because I was on #32887, which is now merged and should help move forward.
So, now on, what I wrote in #32844:

  1. make this PR target 4.4
  2. open a PR against branch 3.4 with the fix applied, and with the SYMFONY_PHPUNIT_BRIDGE_PR set to the number of this very PR in .travis.yaml
  3. we'll merge 1. once things are validated, and you'll have to revert the change on .travis.yaml before we merge 2.

@nicolas-grekas nicolas-grekas mentioned this pull request Aug 2, 2019
23 tasks
@nicolas-grekas nicolas-grekas changed the title [PhpUnitBridge] Add polyfill for assertStringContainsString* [PhpUnitBridge] added polyfill for assertStringContainsString*() Aug 3, 2019
@nicolas-grekas nicolas-grekas changed the base branch from master to 4.4 August 3, 2019 14:50
@nicolas-grekas
Copy link
Member

Thank you @tweichart.

@nicolas-grekas nicolas-grekas merged commit 1602441 into symfony:4.4 Aug 3, 2019
nicolas-grekas added a commit that referenced this pull request Aug 3, 2019
…tring*() (Tobias Weichart)

This PR was merged into the 4.4 branch.

Discussion
----------

[PhpUnitBridge] added polyfill for assertStringContainsString*()

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #32844
| License       | MIT
| Doc PR        | -

this PR provides a polyfill for methods assertStringContainsString and assertStringContainsStringIgnoringCase in preparation for the PHPUnit 9 deprecations.
PR follows the pattern of [this PR](#32869), hence the PR to master

Commits
-------

1602441 [PhpUnitBridge] added polyfill for assertStringContainsString*()
@nicolas-grekas
Copy link
Member

I fixed my comments :)
Would you mind sending a PR on branch 3.4 to use the new methods and remove the related deprecations now please?

@tweichart
Copy link
Author

sorry for the late response, thanks for the fixes. currently i don't know when i'll find time for that, so it's open to anybody to work on it, as i didn't remove any deprecations yet ;-)

@tweichart tweichart deleted the polyfill-phpunit-assertstring branch August 3, 2019 21:43
fabpot added a commit that referenced this pull request Aug 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
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.4 Oct 27, 2019
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.

None yet

3 participants