Skip to content
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

Fix GlobalState collection to ignore the Composer proxy #4846

Merged
merged 1 commit into from Dec 23, 2021

Conversation

Seldaek
Copy link
Contributor

@Seldaek Seldaek commented Dec 23, 2021

Fixes composer/composer#10387

Composer 2.2 introduces some additional indirection for binaries to allow everyone to use custom PHP versions e.g. php7.4 vendor/bin/phpunit and ensure that vendor/phpunit/phpunit/phpunit is executed with php7.4 always (this previously worked only in cases/platforms where symlinks were supported).

Ideally this would be fixed in older PHPUnit versions too if possible.. The patch applies down to PHPUnit 4.x as far as I can tell.

I can workaround it to some extent in Composer using the global var __PHPUNIT_ISOLATION_BLACKLIST / __PHPUNIT_ISOLATION_EXCLUDE_LIST to mark the included (vendor/phpunit/phpunit/phpunit) file excluded but that is only going to fix it for PHPUnit 6+, and I am not sure how reliable that is going to be in the wild if third party code blindly overwrites the global instead of merging their values into it.

@sebastianbergmann sebastianbergmann merged commit 05def51 into sebastianbergmann:8.5 Dec 23, 2021
@sebastianbergmann sebastianbergmann added feature/process-isolation Issues related to running tests in separate PHP processes installation/composer type/bug Something is broken labels Dec 23, 2021
@weirdan weirdan mentioned this pull request Dec 23, 2021
jrfnl added a commit to jrfnl/BrainMonkey that referenced this pull request Dec 29, 2021
Both Composer, as well as PHPUnit have released new versions to try and fix the issue with tests being run with process isolation, which were resulting in the following error:
```
PHPUnit\Framework\Exception: PHP Fatal error:  strict_types declaration must be the very first statement in the script in /home/runner/work/BrainMonkey/BrainMonkey/vendor/phpunit/phpunit/phpunit on line 2
```

While that fixes the builds for runs against the `highest` versions of dependencies, it still does not solve the problem when running the tests with the `lowest` dependencies.

Build against the `lowest` dependencies now hang indefinitely.

This commit attempts to fix this by using Composer 2.1 for builds against `lowest` dependencies.

It also sets a 15 minute time-out for the test runs against the `lowest` dependencies to prevent builds being very slow in reporting.

Refs:
* composer/composer#10387
* sebastianbergmann/phpunit#4846
* https://github.com/composer/composer/releases/tag/2.2.2
* https://github.com/sebastianbergmann/phpunit/blob/9.5/ChangeLog-9.5.md#9511---2021-12-25
jrfnl added a commit to Brain-WP/BrainMonkey that referenced this pull request Dec 29, 2021
Both Composer, as well as PHPUnit have released new versions to try and fix the issue with tests being run with process isolation in combination with installation via Composer 2.2, which were resulting in the following error:
```
PHPUnit\Framework\Exception: PHP Fatal error:  strict_types declaration must be the very first statement in the script in /home/runner/work/BrainMonkey/BrainMonkey/vendor/phpunit/phpunit/phpunit on line 2
```

While that fixes the builds for runs against the `highest` versions of dependencies, it still does not solve the problem when running the tests with the `lowest` dependencies (or against PHP 5.6).

Those builds now hang indefinitely.

This commit attempts to fix this by using Composer 2.1 for builds against `lowest` dependencies and against PHP 5.6.

It also sets a 15 minute time-out for the test runs against the `lowest` dependencies to prevent builds being very slow in reporting.

Refs:
* composer/composer#10387
* sebastianbergmann/phpunit#4846
* https://github.com/composer/composer/releases/tag/2.2.2
* https://github.com/sebastianbergmann/phpunit/blob/9.5/ChangeLog-9.5.md#9511---2021-12-25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/process-isolation Issues related to running tests in separate PHP processes installation/composer type/bug Something is broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants