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] Adjust PHPUnit class_alias check to also check for namespaced class #22925

Merged
merged 1 commit into from May 27, 2017

Conversation

Projects
None yet
6 participants
@GawainLynch
Contributor

GawainLynch commented May 27, 2017

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

Some projects, e.g. Codeception, also alias pre-PHPUnit namespaces leading to a collision and exceptions such as:

[PHPUnit\Framework\Exception (2)]
Cannot declare class Symfony\Bridge\PhpUnit\SymfonyTestsListener, because the name is 
already in use

This just add a check for the namespaced class, and exits if either aliased or exists.

@nicolas-grekas

👍

@fabpot

This comment has been minimized.

Show comment
Hide comment
@fabpot

fabpot May 27, 2017

Member

Thank you @GawainLynch.

Member

fabpot commented May 27, 2017

Thank you @GawainLynch.

@fabpot fabpot merged commit 7ba3afd into symfony:3.3 May 27, 2017

2 of 3 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
fabbot.io Your code looks good.
Details

fabpot added a commit that referenced this pull request May 27, 2017

bug #22925 [PhpUnitBridge] Adjust PHPUnit class_alias check to also c…
…heck for namespaced class (GawainLynch)

This PR was merged into the 3.3 branch.

Discussion
----------

[PhpUnitBridge] Adjust PHPUnit class_alias check to also check for namespaced class

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

Some projects, e.g. [Codeception](https://github.com/Codeception/Codeception/blob/2.3.2/shim.php#L47), also alias pre-PHPUnit namespaces leading to a collision and exceptions such as:

```
[PHPUnit\Framework\Exception (2)]
Cannot declare class Symfony\Bridge\PhpUnit\SymfonyTestsListener, because the name is
already in use
```

This just add a check for the namespaced class, and exits if either aliased or exists.

Commits
-------

7ba3afd Adjust PHPUnit class_alias check to also check for namespaced class

@GawainLynch GawainLynch deleted the GawainLynch:hotfix/phpunit-class-alias branch May 27, 2017

nicolas-grekas added a commit to nicolas-grekas/symfony that referenced this pull request May 28, 2017

Revert "bug #22925 [PhpUnitBridge] Adjust PHPUnit class_alias check t…
…o also check for namespaced class (GawainLynch)"

This reverts commit cfb090d, reversing
changes made to 4e8f403.
@nicolas-grekas

This comment has been minimized.

Show comment
Hide comment
@nicolas-grekas

nicolas-grekas May 28, 2017

Member

This breaks the bridge, see #22929 for reversal.

Member

nicolas-grekas commented May 28, 2017

This breaks the bridge, see #22929 for reversal.

nicolas-grekas added a commit that referenced this pull request May 28, 2017

bug #22929 Revert "bug #22925 [PhpUnitBridge] Adjust PHPUnit class_al…
…ias check (nicolas-grekas)

This PR was merged into the 4.0-dev branch.

Discussion
----------

Revert "bug #22925 [PhpUnitBridge] Adjust PHPUnit class_alias check

This reverts commit cfb090d, reversing
changes made to 4e8f403.

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

PR #22925 made the bridge fail with:
> Fatal error: Declaration of Symfony\Bridge\PhpUnit\SymfonyTestsListener::addSkippedTest() must be compatible with that of PHPUnit_Framework_TestListener::addSkippedTest() in /home/travis/build/symfony/symfony/vendor/symfony/phpunit-bridge/SymfonyTestsListener.php on line 32

See https://travis-ci.org/symfony/symfony/builds/236863221 on 3.3
and https://travis-ci.org/symfony/symfony/builds/236863238 on 3.4

Commits
-------

934c0c0 Revert "bug #22925 [PhpUnitBridge] Adjust PHPUnit class_alias check to also check for namespaced class (GawainLynch)"

nicolas-grekas added a commit that referenced this pull request May 28, 2017

bug #22930 Revert "bug #22925 [PhpUnitBridge] Adjust PHPUnit class_al…
…ias check (nicolas-grekas)

This PR was merged into the 3.3 branch.

Discussion
----------

Revert "bug #22925 [PhpUnitBridge] Adjust PHPUnit class_alias check

This reverts commit cfb090d, reversing
changes made to 4e8f403.

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

PR #22925 made the bridge fail with:
> Fatal error: Declaration of Symfony\Bridge\PhpUnit\SymfonyTestsListener::addSkippedTest() must be compatible with that of PHPUnit_Framework_TestListener::addSkippedTest() in /home/travis/build/symfony/symfony/vendor/symfony/phpunit-bridge/SymfonyTestsListener.php on line 32

See https://travis-ci.org/symfony/symfony/builds/236863221 on 3.3
and https://travis-ci.org/symfony/symfony/builds/236863238 on 3.4

Commits
-------

934c0c0 Revert "bug #22925 [PhpUnitBridge] Adjust PHPUnit class_alias check to also check for namespaced class (GawainLynch)"

nicolas-grekas added a commit that referenced this pull request May 28, 2017

Merge branch '3.3' into 3.4
* 3.3:
  Revert "bug #22925 [PhpUnitBridge] Adjust PHPUnit class_alias check to also check for namespaced class (GawainLynch)"
@nicolas-grekas

This comment has been minimized.

Show comment
Hide comment
@nicolas-grekas

nicolas-grekas May 29, 2017

Member

@GawainLynch please open an other PR if you want to give it another try.

Member

nicolas-grekas commented May 29, 2017

@GawainLynch please open an other PR if you want to give it another try.

@GawainLynch

This comment has been minimized.

Show comment
Hide comment
@GawainLynch

GawainLynch May 29, 2017

Contributor

@nicolas-grekas I will, do. Bolt uses Codeception for acceptance tests, and we've locked at 3.2.1 (before they added that alias), but that makes things "interesting" in the future 😉

I'll think though approach for a bit, and then try try try again 😄

Contributor

GawainLynch commented May 29, 2017

@nicolas-grekas I will, do. Bolt uses Codeception for acceptance tests, and we've locked at 3.2.1 (before they added that alias), but that makes things "interesting" in the future 😉

I'll think though approach for a bit, and then try try try again 😄

@stof

This comment has been minimized.

Show comment
Hide comment
@stof

stof May 29, 2017

Member

A solution might be to check the PHPUnit version instead of relying on class existence to detect PHPUnit versions

Member

stof commented May 29, 2017

A solution might be to check the PHPUnit version instead of relying on class existence to detect PHPUnit versions

@javiereguiluz

This comment has been minimized.

Show comment
Hide comment
@javiereguiluz

javiereguiluz May 29, 2017

Member

@stof but, if I'm right, for Symfony we always do the opposite of what you are proposing: instead of relying on version numbers (for Symfony kernel, Symfony Forms, etc.) we always check if some class exists or if some method exists, etc.

Member

javiereguiluz commented May 29, 2017

@stof but, if I'm right, for Symfony we always do the opposite of what you are proposing: instead of relying on version numbers (for Symfony kernel, Symfony Forms, etc.) we always check if some class exists or if some method exists, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment