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

Appearance settings

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

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

Merged
merged 1 commit into from
May 27, 2017
Merged

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

merged 1 commit into from
May 27, 2017

Conversation

GwendolenLynch
Copy link
Contributor

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.

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

👍

@fabpot
Copy link
Member

fabpot commented May 27, 2017

Thank you @GawainLynch.

@fabpot fabpot merged commit 7ba3afd into symfony:3.3 May 27, 2017
fabpot added a commit that referenced this pull request May 27, 2017
…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
@GwendolenLynch GwendolenLynch deleted the hotfix/phpunit-class-alias branch May 27, 2017 15:10
nicolas-grekas added a commit to nicolas-grekas/symfony that referenced this pull request May 28, 2017
…check to also check for namespaced class (GawainLynch)"

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

This breaks the bridge, see #22929 for reversal.

nicolas-grekas added a commit that referenced this pull request May 28, 2017
…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
…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
* 3.3:
  Revert "bug #22925 [PhpUnitBridge] Adjust PHPUnit class_alias check to also check for namespaced class (GawainLynch)"
@nicolas-grekas
Copy link
Member

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

@GwendolenLynch
Copy link
Contributor Author

@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
Copy link
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
Copy link
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.

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.

6 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.