Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Avoid phpunit 5.4 warnings on getMock (master)#19129
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
Avoid phpunit 5.4 warnings on getMock (master)#19129
Uh oh!
There was an error while loading.Please reload this page.
Conversation
xabbuh commentedJun 21, 2016
👍 LGTM |
Tobion commentedJun 21, 2016
👍 |
rybakit commentedJun 21, 2016
What about replacing trait PhpUnitCompat{/** * @param string $originalClassName * * @return \PHPUnit_Framework_MockObject_MockObject */publicfunctioncreateMock($originalClassName) {if (is_callable('parent::createMock')) {returnparent::createMock($originalClassName); }return$this->getMockBuilder($originalClassName) ->disableOriginalConstructor() ->disableOriginalClone() ->disableArgumentCloning() ->getMock(); }} |
stof commentedJun 21, 2016
We would have to include the trait everywhere in our testsuite, because we cannot require PHPUnit 5 in our testsuite (as we support PHP 5.5). So it is not worth it IMO. |
nicolas-grekas commentedJun 21, 2016
Thank you@iltar. |
This PR was merged into the 3.2-dev branch.Discussion----------Avoid phpunit 5.4 warnings on getMock (master)| Q | A| ------------- | ---| Branch? | master| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#19125| License | MIT| Doc PR | ~Avoids calling `getMock()` in phpunit 5.4 which will trigger a warning (and thus failing test suite) when used by developers as this TestCase is an extension point._in the other branches (opposed to#19128), this was not in the `Test` namespace yet but in `Tests`. Therefore I've only added this in the master as changed by@wouterj ine938361._Commits-------eb8c27e Avoid phpunit 5.4 warnings on getMock
codeinabox commentedJun 29, 2016
Great. Which version will this appear in? |
xabbuh commentedJun 29, 2016
@codeinabox Symfony 3.2 |
codeinabox commentedJun 29, 2016
In the interim is there an easy way to downgrade my version of PHPUnit? I tried setting the version constraint to |
xabbuh commentedJun 29, 2016
Not sure I understand. In which context do you run into issues? |
codeinabox commentedJun 29, 2016
I have a lot of unit tests for my forms that extend Symfony\Component\Form\Test\TypeTestCase, which results in getMock() deprecation warnings. |
xabbuh commentedJun 29, 2016
That class was updated in#19128 which will be part of 2.7.15. |
Avoids calling
getMock()in phpunit 5.4 which will trigger a warning (and thus failing test suite) when used by developers as this TestCase is an extension point.in the other branches (opposed to#19128), this was not in the
Testnamespace yet but inTests. Therefore I've only added this in the master as changed by@wouterj ine938361.