diff --git a/package_manager/src/ProjectInfo.php b/package_manager/src/ProjectInfo.php index ef3b78301b6149988f8bf84386605381d690fc32..a12369f23a86eb9098152858bf9126cd2b469237 100644 --- a/package_manager/src/ProjectInfo.php +++ b/package_manager/src/ProjectInfo.php @@ -108,18 +108,10 @@ final class ProjectInfo { } $installed_version = $this->getInstalledVersion(); - if ($installed_version) { - // If the project is installed, and we're already up-to-date, there's - // nothing else we need to do. - if ($project['status'] === UpdateManagerInterface::CURRENT) { - return []; - } - - if (empty($available_updates['releases'])) { - // If project is installed but not current we should always have at - // least one release. - throw new \RuntimeException('There was a problem getting update information. Try again later.'); - } + if ($installed_version && empty($available_updates['releases'])) { + // If project is installed but not current we should always have at + // least one release. + throw new \RuntimeException('There was a problem getting update information. Try again later.'); } $support_branches = explode(',', $available_updates['supported_branches']); diff --git a/package_manager/tests/fixtures/release-history/drupal.9.8.0-alpha1.xml b/package_manager/tests/fixtures/release-history/drupal.9.8.0-alpha1.xml new file mode 100644 index 0000000000000000000000000000000000000000..1fbd15b275f521b096e7a6eaa57b3640aa2b2bb4 --- /dev/null +++ b/package_manager/tests/fixtures/release-history/drupal.9.8.0-alpha1.xml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Contains metadata about the following (fake) releases of Drupal core, all of which are secure, in order: +* 9.8.0-alpha1 +* 9.7.1 +* 9.7.0 +--> +<project xmlns:dc="http://purl.org/dc/elements/1.1/"> + <title>Drupal</title> + <short_name>drupal</short_name> + <dc:creator>Drupal</dc:creator> + <supported_branches>9.7.,9.8.</supported_branches> + <project_status>published</project_status> + <link>http://example.com/project/drupal</link> + <terms> + <term> + <name>Projects</name> + <value>Drupal project</value> + </term> + </terms> + <releases> + <release> + <name>Drupal 9.8.0-alpha1</name> + <version>9.8.0-alpha1</version> + <status>published</status> + <release_link>http://example.com/drupal-9-8-0-alpha1-release</release_link> + <download_link>http://example.com/drupal-9-8-0-alpha1.tar.gz</download_link> + <date>1250424521</date> + <terms> + <term> + <name>Release type</name> + <value>New features</value> + </term> + <term> + <name>Release type</name> + <value>Bug fixes</value> + </term> + </terms> + </release> + <release> + <name>Drupal 9.7.1</name> + <version>9.7.1</version> + <status>published</status> + <release_link>http://example.com/drupal-9-7-1-release</release_link> + <download_link>http://example.com/drupal-9-7-1.tar.gz</download_link> + <date>1250425521</date> + <terms> + <term> + <name>Release type</name> + <value>New features</value> + </term> + <term> + <name>Release type</name> + <value>Bug fixes</value> + </term> + </terms> + </release> + <release> + <name>Drupal 9.7.0</name> + <version>9.7.0</version> + <status>published</status> + <release_link>http://example.com/drupal-9-7-0-release</release_link> + <download_link>http://example.com/drupal-9-7-0.tar.gz</download_link> + <date>1250424521</date> + <terms> + <term> + <name>Release type</name> + <value>New features</value> + </term> + <term> + <name>Release type</name> + <value>Bug fixes</value> + </term> + </terms> + </release> + </releases> +</project> diff --git a/package_manager/tests/src/Kernel/ProjectInfoTest.php b/package_manager/tests/src/Kernel/ProjectInfoTest.php index 2a459cc8bb5bbbf82a04d24b3a1e3c5b2bbbdb07..97dfe1b0ca47b6261f2c304ec1744df283811f59 100644 --- a/package_manager/tests/src/Kernel/ProjectInfoTest.php +++ b/package_manager/tests/src/Kernel/ProjectInfoTest.php @@ -67,6 +67,11 @@ class ProjectInfoTest extends PackageManagerKernelTestBase { '9.8.2', [], ], + 'core, on supported branch, pre-release in next minor' => [ + 'drupal.9.8.0-alpha1.xml', + '9.7.1', + ['9.8.0-alpha1'], + ], 'core, on unsupported branch, updates in multiple supported branches' => [ 'drupal.9.8.2.xml', '9.6.0-alpha1',