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

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

Merged
nicolas-grekas merged 1 commit intosymfony:masterfromlinaori:fix/phpunit54-compat-master
Jun 21, 2016
Merged

Avoid phpunit 5.4 warnings on getMock (master)#19129

nicolas-grekas merged 1 commit intosymfony:masterfromlinaori:fix/phpunit54-compat-master
Jun 21, 2016

Conversation

@linaori
Copy link
Contributor

QA
Branch?master
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#19125
LicenseMIT
Doc PR~

Avoids callinggetMock() 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 theTest namespace yet but inTests. Therefore I've only added this in the master as changed by@wouterj ine938361.

@xabbuh
Copy link
Member

👍 LGTM

@Tobion
Copy link
Contributor

👍

@rybakit
Copy link
Contributor

What about replacinggetMock() withcreateMock() and adding compatibility trait for phpunit < 5.4:

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
Copy link
Member

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
Copy link
Member

Thank you@iltar.

@nicolas-grekasnicolas-grekas merged commiteb8c27e intosymfony:masterJun 21, 2016
nicolas-grekas added a commit that referenced this pull requestJun 21, 2016
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
Copy link

Great. Which version will this appear in?

@xabbuh
Copy link
Member

@codeinabox Symfony 3.2

@codeinabox
Copy link

In the interim is there an easy way to downgrade my version of PHPUnit? I tried setting the version constraint to5.3.* but composer didn't seem to like that

@xabbuh
Copy link
Member

Not sure I understand. In which context do you run into issues?

@codeinabox
Copy link

I have a lot of unit tests for my forms that extend Symfony\Component\Form\Test\TypeTestCase, which results in getMock() deprecation warnings.

@xabbuh
Copy link
Member

That class was updated in#19128 which will be part of 2.7.15.

@fabpotfabpot mentioned this pull requestOct 27, 2016
@linaorilinaori deleted the fix/phpunit54-compat-master branchFebruary 8, 2019 13:38
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

8 participants

@linaori@xabbuh@Tobion@rybakit@stof@nicolas-grekas@codeinabox@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp