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

[Bridge\PhpUnit] Disable broken auto-require mechanism of phpunit#25032

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

Conversation

@nicolas-grekas
Copy link
Member

QA
Branch?3.4
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#25017
LicenseMIT
Doc PR-

It took me all the flight back from Cluj to figure out this is the only way to solve this nasty issue created by phpunit generating inlinedrequire_once in the global scope for isolated tests.
This mechanism predates the autoloading mechanism, and it's behavior is just hardcoded.
Needs to be merged in 3.4, where the split container triggers this situation very quickly.

Will allow removing thefunction_exists('__phpunit_run_isolated_test') workarounds already in place in the code base (2.7 up to master.)

@nicolas-grekasnicolas-grekas changed the base branch from3.4 to3.3November 19, 2017 17:07
@nicolas-grekas
Copy link
MemberAuthor

moved to 3.3 to prevent conflicts between local and vendor phpunit bridges

@nicolas-grekasnicolas-grekas modified the milestones:3.4,3.3Nov 19, 2017
@nicolas-grekasnicolas-grekas merged commit0577d20 intosymfony:3.3Nov 19, 2017
nicolas-grekas added a commit that referenced this pull requestNov 19, 2017
…phpunit (nicolas-grekas)This PR was merged into the 3.3 branch.Discussion----------[Bridge\PhpUnit] Disable broken auto-require mechanism of phpunit| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#25017| License       | MIT| Doc PR        | -It took me all the flight back from Cluj to figure out this is the only way to solve this nasty issue created by phpunit generating inlined `require_once` in the global scope for isolated tests.This mechanism predates the autoloading mechanism, and it's behavior is just hardcoded.Needs to be merged in 3.4, where the split container triggers this situation very quickly.Will allow removing the `function_exists('__phpunit_run_isolated_test')` workarounds already in place in the code base (2.7 up to master.)Commits-------0577d20 [Bridge\PhpUnit] Disable broken auto-require mechanism of phpunit
nicolas-grekas added a commit that referenced this pull requestNov 19, 2017
…ks (nicolas-grekas)This PR was merged into the 2.7 branch.Discussion----------Remove function_exists(__phpunit_run_isolated_test) checks| Q             | A| ------------- | ---| Branch?       | 2.7| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -As now permitted by#25032Commits-------a512217 Remove function_exists(__phpunit_run_isolated_test) checks
@greg0ire
Copy link
Contributor

greg0ire commentedNov 19, 2017
edited
Loading

I'm getting

phpunitPHPUnit 5.7.23 by Sebastian Bergmann and contributors.Cannot declare class PHPUnit_Util_Blacklist, because the name is already in usevendor/bin/simple-phpunitwhich: no composer.phar in (/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/home/greg/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/greg/src/shunit2:/home/greg/.fzf/bin)PHPUnit 5.7.25 by Sebastian Bergmann and contributors.Cannot declare class PHPUnit_Util_Blacklist, because the name is already in use

since upgrading to the latest 3.4.

Not entirely sure it's related yet.

UPDATE: I have the same issue with 3.x, I'll try bisecting.

@greg0ire
Copy link
Contributor

greg0ire commentedNov 19, 2017
edited
Loading

0577d20 is the first bad commit

commit 0577d20ade7d6191c68174c8a3fe68d84072e442Author: Nicolas Grekas <nicolas.grekas@gmail.com>Date:   Sun Nov 19 14:29:22 2017 +0200    [Bridge\PhpUnit] Disable broken auto-require mechanism of phpunit:040000 040000 4c11b70dd68fe5f6fa1cadd4058c8ab9eaca6d6d b329a21a1e6bc48a4abf48379745af28e6d443d9 Msrc

@nicolas-grekasnicolas-grekas deleted the phpunit-blacklist-all branchNovember 19, 2017 19:15
@nicolas-grekas
Copy link
MemberAuthor

did you remove the.phpunit cache folder?

@greg0ire
Copy link
Contributor

greg0ire commentedNov 19, 2017
edited
Loading

I just tried removing./vendor/symfony/phpunit-bridge/bin/.phpunit, it doesn't help, be it with the phar or with simple-phpunit

@greg0ire
Copy link
Contributor

Here is a simple reproducer:

git clone git@github.com:sonata-project/SonataMediaBundle.gitcd SonataMediaBundlecomposer require symfony/symfony '3.3.x-dev as 3.3.0'vendor/bin/simple-phpunit

@nicolas-grekas
Copy link
MemberAuthor

@greg0ire can you try again? could/should be fixed.

@greg0ire
Copy link
Contributor

No luck it seems, with both the phar and simple-phpunit (with.phpunit removed)

composer update -vLoading composer repositories with package informationUpdating dependencies (including require-dev)Dependency resolution completed in 0.711 secondsAnalyzed 13943 packages to resolve dependenciesAnalyzed 521378 rules to resolve dependenciesDependency resolution completed in 0.000 secondsPackage operations: 0 installs, 1 update, 0 removalsUpdates: symfony/symfony:3.3.x-dev 0187e9b  - Updating symfony/symfony 3.3.x-dev (f2fc7bf => 0187e9b):  Checking out 0187e9b3400e55b978901483ad71f40dc48c70ed    Pulling in changes:      0187e9b340 - Nicolas Grekas: [Bridge/PhpUnit] Fix compat with phpunit 4.8 & bridge <=3.3.13Package amazonwebservices/aws-sdk-for-php is abandoned, you should avoid using it. Use aws/aws-sdk-php instead.Package guzzle/guzzle is abandoned, you should avoid using it. Use guzzlehttp/guzzle instead.Writing lock fileGenerating autoload files╭─greg@liche in /tmp/SonataMediaBundle on 3.x ✘ (origin/3.x)╰$ phpunit                                            PHPUnit 5.7.23 by Sebastian Bergmann and contributors.Cannot declare class PHPUnit_Util_Blacklist, because the name is already in use

@nicolas-grekas
Copy link
MemberAuthor

ok, then I need a reproducer that actually works :)
the previous didn't have the issue actually
exact PHP + phpunit versions might help?

@greg0ire
Copy link
Contributor

greg0ire commentedNov 19, 2017
edited
Loading

Here you go:

php --versionPHP 7.1.11 (cli) (built: Oct 25 2017 07:27:25) ( NTS )Copyright (c) 1997-2017 The PHP GroupZend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies    with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethansphpunit --versionPHPUnit 5.7.23 by Sebastian Bergmann and contributors.vendor/bin/simple-phpunit --versionwhich: no composer.phar in (/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/home/greg/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/greg/src/shunit2:/home/greg/.fzf/bin)PHPUnit 5.7.25 by Sebastian Bergmann and contributors.

Not sure why this can't be reproduced easily 😅

@nicolas-grekas
Copy link
MemberAuthor

@greg0ire OK, actually that's a bug in Sonata's tests/bootstrap.php:
the bridge isnot provided by thesymfony/symfony: even if the code is there, it is voluntarily excluded from "replace" and "autoload" sections in symfony's main composer.json. The lines in your bootstrap.php files that looks for the bridge in symfony/symfony need to be removed.

@greg0ire
Copy link
Contributor

Thanks a lot for the diagnosis, sorry we had that weird stuff, we're going to simplify. Cc@soullivaneuh@core23@OskarStark@jordisala1991@jlamur

OskarStark reacted with thumbs up emoji

This was referencedNov 21, 2017
@fabpotfabpot mentioned this pull requestDec 4, 2017
@teohhanhui
Copy link
Contributor

So there is no other way than to usesimple-phpunit? Or was this fixed at some point inphpunit itself?

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

3.3

Development

Successfully merging this pull request may close these issues.

4 participants

@nicolas-grekas@greg0ire@teohhanhui@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp