From 207966000bd6199e387902bb2256ac51aade0672 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 21 Jan 2025 13:22:29 +1300 Subject: [PATCH] FIX Use installer 5.3 with graphql 5.2 --- consts.php | 6 ++- job_creator.php | 5 ++- tests/JobCreatorTest.php | 97 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+), 3 deletions(-) diff --git a/consts.php b/consts.php index ad24396..61c4302 100644 --- a/consts.php +++ b/consts.php @@ -417,7 +417,11 @@ 'silverstripe-environmentcheck' => '3.0', 'silverstripe-externallinks' => '3.2', 'silverstripe-fluent' => '7.1', - 'silverstripe-graphql' => '5.2', + // GraphQL is commented out here to ensure that it's installed using + // installer 5.3, instead of installer 5.2 + // This is done because otherwise an elemental behat test will fail because + // it needs a fix which is in framework 5.3 + // 'silverstripe-graphql' => '5.2', 'silverstripe-gridfield-bulk-editing-tools' => '4.0', 'silverstripe-gridfieldextensions' => '4.0', 'silverstripe-gridfieldqueuedexport' => '3.2', diff --git a/job_creator.php b/job_creator.php index c49dc81..e558411 100644 --- a/job_creator.php +++ b/job_creator.php @@ -56,7 +56,8 @@ public function getInstallerVersion( foreach (INSTALLER_TO_REPO_MINOR_VERSIONS[$installerVersion] as $_repo => $_repoVersions) { $repoVersions = is_array($_repoVersions) ? $_repoVersions : [$_repoVersions]; foreach ($repoVersions as $repoVersion) { - if ($this->repoName === $_repo && $repoVersion === preg_replace('#-release$#', '', $this->branch)) { + $thisBranch = preg_replace('#-release$#', '', $this->branch); + if ($this->repoName === $_repo && $thisBranch === $repoVersion) { return $installerVersion . '.x-dev'; } } @@ -374,7 +375,7 @@ private function getListOfPhpVersionsByBranchName(): array // Fallback to using a CMS major based on the version of PHP in composer.json $json = $this->getComposerJsonContent(); if ($json) { - $php = $json->require->php ?? null; + $php = $json->require->php ?? ''; $php = str_replace('^', '', $php); $cmsMajors = array_keys(MetaData::PHP_VERSIONS_FOR_CMS_RELEASES); $cmsMajors = array_filter($cmsMajors, fn($v) => !str_contains($v, '.')); diff --git a/tests/JobCreatorTest.php b/tests/JobCreatorTest.php index 570db2b..d923052 100644 --- a/tests/JobCreatorTest.php +++ b/tests/JobCreatorTest.php @@ -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', + ], + ] + ], ]; }