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

[WIP][PHPUnitBridge] Cross compatibility between PHPUnit 5 and 6#21158

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

Closed
Jean85 wants to merge11 commits intosymfony:masterfromJean85:phpunit_6_bridge_compat

Conversation

@Jean85
Copy link
Contributor

QA
Branch?master
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#21125
LicenseMIT

Still WIP... I have doubt on how to solve (preserving BC) the case where the target class that I want to replace is a public method's argument typehint, like inSymfonyTestsListener::addSkippedTest:

publicfunctionaddSkippedTest(\PHPUnit_Framework_Test$test,\Exception$e,$time)

@Jean85
Copy link
ContributorAuthor

Status: needs work


namespaceSymfony\Bridge\PhpUnit\Compat\Framework;

if (class_exists(PHPUnit\Framework\BaseTestListener::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 is a no-go. the bridge must stay compatible with PHP 5.3 to be usable in the Symfony LTS CI setup.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Good catch! Already fixed, the Travis build reported this.

composer.json Outdated
"psr-4": {
"Symfony\\Bridge\\Doctrine\\":"src/Symfony/Bridge/Doctrine/",
"Symfony\\Bridge\\Monolog\\":"src/Symfony/Bridge/Monolog/",
"Symfony\\Bridge\\PhpUnit\\Compat\\":"src/Symfony/Bridge/PhpUnit/Compat/",
Copy link
Member

Choose a reason for hiding this comment

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

-1 for this. The PHPUnit bridge is not meant to be autoloaded from the main Symfony repo

Copy link
ContributorAuthor

@Jean85Jean85Jan 4, 2017
edited
Loading

Choose a reason for hiding this comment

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

I'm not autoloading the whole bridge but just the Compat classes, otherwise this will not work. Do you have any suggestions for an alternate approach?

[EDIT] I've done this here since the normal autoload was failing during the SecurityBundle tests in the build. Maybe it's just a build issue?

Copy link
Member

Choose a reason for hiding this comment

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

These classes must be autoloaded by the bridge only. Anything else is wrong.

A failure may be related to cases mixing a downloaded version of the bridge and your patched version here. But I have not seen the failure you are talking about. The only build failures on Travis on the commit before this one are about broken signatures.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

You're right, we have to load that just in the bridge. I've reverted that but the build is failing:https://travis-ci.org/Jean85/symfony/jobs/188845916#L1983

Copy link
Member

Choose a reason for hiding this comment

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

but ths has nothing to do with SecurityBundle. It is a failure when testing the bridge itself

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yeah, you're right. In fact, the PR build is green, great!https://travis-ci.org/symfony/symfony/builds/188846004


namespaceSymfony\Bridge\PhpUnit\Compat\Framework;

if (class_exists(PHPUnit\Framework\BaseTestListener::class)) {
Copy link
Member

Choose a reason for hiding this comment

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

and if it was kept, there is a missing\ here, meaning you check forSymfony\Bridge\PhpUnit\Compat\Framework\PHPUnit\Framework\BaseTestListener

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Good catch! Already fixed, the Travis build reported this too.

class Blacklistextends \PHPUnit\Util\Blacklist
{}
}else {
class Blacklistextends \PHPUnit_Util_Blacklist
Copy link
Member

Choose a reason for hiding this comment

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

there is no reason to create this class. We need compat classes only when extending them. Otherwise, we can do the class_exists check around the usage of the class, which is much more readable

$skipped =array();
foreach ($suite->tests()as$test) {
if (!$testinstanceof \PHPUnit_Framework_TestCase
if (!$this->isInstanceOfPHPUnitTestSuite($test)
Copy link
Member

Choose a reason for hiding this comment

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

method name is weird, as the check was for TestCase

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Good catch! Thanks, fixing it

namespaceSymfony\Bridge\PhpUnit\Compat\Framework;

if (class_exists(PHPUnit\Framework\BaseTestListener::class)) {
abstractclass BaseTestListenerextends \PHPUnit\Framework\BaseTestListener
Copy link
Member

Choose a reason for hiding this comment

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

this class (and all other classes here) must be tagged as@internal so that there are not covered by BC.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Right! Doing it RN

@Jean85
Copy link
ContributorAuthor

Ok, the build is green, but still I don't know how to proceed for the class in typehints...
I've suggested an approach here:#21125 (comment)

@nicolas-grekasnicolas-grekas added this to the3.x milestoneJan 6, 2017
@Jean85
Copy link
ContributorAuthor

Closing in favor of#21221

@Jean85Jean85 closed thisJan 9, 2017
@nicolas-grekasnicolas-grekas modified the milestones:3.x,3.3Mar 24, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof requested changes

Assignees

No one assigned

Projects

None yet

Milestone

3.3

Development

Successfully merging this pull request may close these issues.

4 participants

@Jean85@stof@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp