diff --git a/job_creator.php b/job_creator.php index c49dc81..9951218 100644 --- a/job_creator.php +++ b/job_creator.php @@ -52,7 +52,9 @@ public function getInstallerVersion( } } // hardcoded installer version for repo version - foreach (array_keys(INSTALLER_TO_REPO_MINOR_VERSIONS) as $installerVersion) { + $keys = array_keys(INSTALLER_TO_REPO_MINOR_VERSIONS); + $keys = array_reverse($keys); + foreach ($keys as $installerVersion) { foreach (INSTALLER_TO_REPO_MINOR_VERSIONS[$installerVersion] as $_repo => $_repoVersions) { $repoVersions = is_array($_repoVersions) ? $_repoVersions : [$_repoVersions]; foreach ($repoVersions as $repoVersion) { @@ -375,7 +377,7 @@ private function getListOfPhpVersionsByBranchName(): array $json = $this->getComposerJsonContent(); if ($json) { $php = $json->require->php ?? null; - $php = str_replace('^', '', $php); + $php = str_replace('^', '', $php ?? ''); $cmsMajors = array_keys(MetaData::PHP_VERSIONS_FOR_CMS_RELEASES); $cmsMajors = array_filter($cmsMajors, fn($v) => !str_contains($v, '.')); $cmsMajors = array_reverse($cmsMajors); diff --git a/tests/JobCreatorTest.php b/tests/JobCreatorTest.php index 570db2b..9a439ee 100644 --- a/tests/JobCreatorTest.php +++ b/tests/JobCreatorTest.php @@ -184,7 +184,7 @@ public function provideGetInstallerVersion(): array 'html5-1' => ['myaccount/silverstripe-html5', '2', $nextMinorCms4], 'html5-2' => ['myaccount/silverstripe-html5', '2.2', '4.10.x-dev'], 'html5-3' => ['myaccount/silverstripe-html5', '2.3', '4.10.x-dev'], - 'html5-4' => ['myaccount/silverstripe-html5', '2.4', '4.11.x-dev'], + 'html5-4' => ['myaccount/silverstripe-html5', '2.4', '4.13.x-dev'], 'html5-5' => ['myaccount/silverstripe-html5', 'burger', $currentMinorCms4], // force installer unlockedstepped repo 'serve1' => ['myaccount/silverstripe-serve', '2', $nextMinorCms4], @@ -1144,6 +1144,103 @@ public function provideCreateJson(): array ], ] ], + // test for graphql 5.2 which is used in both installer 5.3 and installer 5.2 + // it should use installer 5.3.x-dev + [ + implode("\n", [ + $this->getGenericYml(), + << '5.3.x-dev', + 'php' => '8.1', + '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' => 'true', + 'name' => '8.1 prf-low mysql57 phpunit all', + ], + [ + 'installer_version' => '5.3.x-dev', + 'php' => '8.2', + 'db' => DB_MARIADB, + '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' => 'true', + 'name' => '8.2 mariadb phpunit all', + ], + [ + 'installer_version' => '5.3.x-dev', + 'php' => '8.3', + 'db' => DB_MYSQL_80, + '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' => 'true', + 'name' => '8.3 mysql80 phpunit all', + ], + [ + 'installer_version' => '5.3.x-dev', + 'php' => '8.3', + 'db' => DB_MYSQL_84, + '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' => 'true', + 'name' => '8.3 mysql84 phpunit all', + ], + ] + ], ]; }