Skip to content

Commit

Permalink
Test bootstrap: tweak the version determination regex
Browse files Browse the repository at this point in the history
Apparently, Composer 2.3.0 dropped the word `version` from the `--version` output ;-)

Output on Composer 2.2 and lower:
```
Composer version 2.2.10 2022-03-29 21:55:35
```

Composer 2.3 output:
```
Composer 2.3.0 2022-03-30 11:15:36
```
  • Loading branch information
jrfnl committed Mar 30, 2022
1 parent fc4e33e commit 9b9e823
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Expand Up @@ -114,7 +114,7 @@
// Get the version of Composer being used.
$command = '"' . \PHP_BINARY . '" "' . \COMPOSER_PHAR . '" --version --no-ansi --no-interaction';
$lastLine = exec($command, $output, $exitcode);
if ($exitcode === 0 && preg_match('`Composer version ([^\s]+)`', $lastLine, $matches) === 1) {
if ($exitcode === 0 && preg_match('`Composer (?:version )?([^\s]+)`', $lastLine, $matches) === 1) {
define('COMPOSER_VERSION', $matches[1]);
} else {
echo 'Could not determine the version of Composer being used.';
Expand Down

0 comments on commit 9b9e823

Please sign in to comment.