diff --git a/job_creator.php b/job_creator.php index 400418c..47dbb99 100644 --- a/job_creator.php +++ b/job_creator.php @@ -186,7 +186,7 @@ private function isAllowedPhpVersion(string $phpVersion) } $this->composerPhpConstraint = $json->require->php; } - $constraints = explode('||', $this->composerPhpConstraint); + $constraints = preg_split('#(\|\||\|)#', $this->composerPhpConstraint); $constraints = array_map(function($php) { return preg_replace('#([0-9\.\*]+) *- *([0-9\.\*]+)#', '$1-$2', trim($php)); }, $constraints); diff --git a/tests/JobCreatorTest.php b/tests/JobCreatorTest.php index bed43f4..04117bb 100644 --- a/tests/JobCreatorTest.php +++ b/tests/JobCreatorTest.php @@ -1027,6 +1027,52 @@ public function provideCreateJsonForConfig(): array ], ], ], + 'cms 4 old composer pipe' => [ + 'branch' => '1.6', + 'phpConstraint' => '7.4 | 8.0', + 'expected' => [ + [ + 'installer_version' => '', + 'php' => '7.4', + 'db' => DB_MYSQL_57, + 'composer_require_extra' => '', + 'composer_args' => '--prefer-lowest', + 'name_suffix' => '', + 'phpunit' => 'true', + 'phpunit_suite' => 'all', + 'phplinting' => 'false', + 'phpcoverage' => 'false', + 'endtoend' => 'false', + 'endtoend_suite' => 'root', + 'endtoend_config' => '', + 'endtoend_tags' => '', + 'js' => 'false', + 'doclinting' => 'false', + 'needs_full_setup' => 'false', + 'name' => '7.4 prf-low mysql57 phpunit all', + ], + [ + 'installer_version' => '', + 'php' => '8.0', + 'db' => DB_MYSQL_57_PDO, + 'composer_require_extra' => '', + 'composer_args' => '', + 'name_suffix' => '', + 'phpunit' => 'true', + 'phpunit_suite' => 'all', + 'phplinting' => 'false', + 'phpcoverage' => 'false', + 'endtoend' => 'false', + 'endtoend_suite' => 'root', + 'endtoend_config' => '', + 'endtoend_tags' => '', + 'js' => 'false', + 'doclinting' => 'false', + 'needs_full_setup' => 'false', + 'name' => '8.0 mysql57pdo phpunit all', + ], + ], + ], 'cms 5.1+' => [ 'branch' => '2.1', 'phpConstraint' => '^8.1',