Loading automatic_updates_extensions/src/Form/UpdaterForm.php +4 −1 Original line number Diff line number Diff line Loading @@ -232,6 +232,9 @@ final class UpdaterForm extends FormBase { * Modules that require updates. */ private function getRecommendedModuleUpdates(): array { $supported_project_types = [ "module", "module-disabled", "theme", "theme-disabled", ]; $available_updates = update_get_available(TRUE); if (empty($available_updates)) { $this->messenger()->addError('There was a problem getting update information. Try again later.'); Loading @@ -243,7 +246,7 @@ final class UpdaterForm extends FormBase { $installed_packages = array_keys($this->extensionUpdater->getActiveComposer()->getInstalledPackages()); $non_supported_update_statuses = []; foreach ($project_data as $project_name => $project_info) { if ($project_info['project_type'] === 'module' || $project_info['project_type'] === 'module-disabled') { if (in_array($project_info['project_type'], $supported_project_types, TRUE)) { if ($project_info['status'] !== UpdateManagerInterface::CURRENT) { if (!in_array("drupal/$project_name", $installed_packages, TRUE)) { $non_supported_update_statuses[] = $project_info['status']; Loading automatic_updates_extensions/tests/fixtures/active_composer/two_projects/vendor/composer/installed.json +5 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,11 @@ "name": "drupal/aaa_update_test", "version": "9.8.1", "type": "drupal-module" }, { "name": "drupal/test_theme", "version": "9.8.1", "type": "drupal-theme" } ] } automatic_updates_extensions/tests/fixtures/release-history/test_theme.1.1.xml 0 → 100644 +119 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <project xmlns:dc="http://purl.org/dc/elements/1.1/"> <title>Test theme</title> <short_name>test_theme</short_name> <dc:creator>drupal</dc:creator> <type>project_theme</type> <supported_branches>8.x-2.,3.0.</supported_branches> <project_status>published</project_status> <link>http://example.com/project/test_theme</link> <terms> <term> <name>Projects</name> <value>Themes</value> </term> <term> <name>Maintenance status</name> <value>Minimally maintained</value> </term> <term> <name>Development status</name> <value>Under active development</value> </term> </terms> <releases> <release> <name>test_theme 3.0.0</name> <version>3.0.0</version> <tag>3.0.0</tag> <status>published</status> <release_link>http://example.com/test_theme/releases/3.0.0</release_link> <download_link>http://example.com/test_theme-3.0.0.tar.gz</download_link> <date>1597793786</date> <files> <file> <url>http://example.com/test_theme-3.0.0.tar.gz</url> <archive_type>tar.gz</archive_type> <md5>43956be126b27d718ecffd0b17244aa1</md5> <size>196080</size> <filedate>1597793786</filedate> </file> <file> <url>http://example.com/test_theme-3.0.0.zip</url> <archive_type>zip</archive_type> <md5>5d24ec88ac4755af6ccbe6ef5ff8b3c9</md5> <size>200399</size> <filedate>1597793786</filedate> </file> </files> <security covered="1">Covered by Drupal's security advisory policy</security> <core_compatibility>^8 || ^9</core_compatibility> </release> <release> <name>test_theme 8.x-2.1</name> <version>8.x-2.1</version> <tag>8.x-2.1</tag> <status>published</status> <release_link>http://example.com/test_theme/releases/8.x-2.1</release_link> <download_link>http://example.com/test_theme-8.x-2.1.tar.gz</download_link> <date>1597793786</date> <files> <file> <url>http://example.com/test_theme-8.x-2.1.tar.gz</url> <archive_type>tar.gz</archive_type> <md5>43956be126b27d718ecffd0b17244aa1</md5> <size>196080</size> <filedate>1597793786</filedate> </file> <file> <url>http://example.com/test_theme-8.x-2.1.zip</url> <archive_type>zip</archive_type> <md5>5d24ec88ac4755af6ccbe6ef5ff8b3c9</md5> <size>200399</size> <filedate>1597793786</filedate> </file> </files> <terms> <term> <name>Release type</name> <value>Bug fixes</value> </term> </terms> <security covered="1">Covered by Drupal's security advisory policy</security> <core_compatibility>8.x</core_compatibility> </release> <release> <name>test_theme 8.x-2.0</name> <version>8.x-2.0</version> <tag>8.x-2.0</tag> <status>published</status> <release_link>http://example.com/test_theme/releases/8.x-2.0</release_link> <download_link>http://example.com/test_theme-8.x-2.0.tar.gz</download_link> <date>1597793786</date> <files> <file> <url>http://example.com/test_theme-8.x-2.0.tar.gz</url> <archive_type>tar.gz</archive_type> <md5>43956be126b27d718ecffd0b17244aa1</md5> <size>196080</size> <filedate>1597793786</filedate> </file> <file> <url>http://example.com/test_theme-8.x-2.0.zip</url> <archive_type>zip</archive_type> <md5>5d24ec88ac4755af6ccbe6ef5ff8b3c9</md5> <size>200399</size> <filedate>1597793786</filedate> </file> </files> <terms> <term> <name>Release type</name> <value>Bug fixes</value> </term> </terms> <security covered="1">Covered by Drupal's security advisory policy</security> <core_compatibility>8.x</core_compatibility> </release> </releases> </project> automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php +17 −4 Original line number Diff line number Diff line Loading @@ -49,8 +49,15 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { */ public function providerSuccessfulUpdate(): array { return [ 'maintenance mode on, semver' => [TRUE, 'semver_test', '8.1.0', '8.1.1'], 'maintenance mode off, legacy' => [FALSE, 'aaa_update_test', '8.x-2.0', '8.x-2.1'], 'maintenance mode on, semver module' => [ TRUE, 'semver_test', 'Semver Test', '8.1.0', '8.1.1', ], 'maintenance mode off, legacy module' => [ FALSE, 'aaa_update_test', 'AAA Update test', '8.x-2.0', '8.x-2.1', ], 'maintenance mode off, legacy theme' => [ FALSE, 'test_theme', 'Test theme', '8.x-2.0', '8.x-2.1', ], ]; } Loading Loading @@ -134,6 +141,8 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { * Whether maintenance should be on at the beginning of the update. * @param string $project_name * The project name. * @param string $project_title * The project title. * @param string $installed_version * The installed version. * @param string $target_version Loading @@ -141,9 +150,13 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { * * @dataProvider providerSuccessfulUpdate */ public function testSuccessfulUpdate(bool $maintenance_mode_on, string $project_name, string $installed_version, string $target_version): void { public function testSuccessfulUpdate(bool $maintenance_mode_on, string $project_name, string $project_title, string $installed_version, string $target_version): void { $this->container->get('theme_installer')->install(['automatic_updates_theme_with_updates']); $this->updateProject = $project_name; // By default, the Update module only checks for updates of installed modules // and themes. The two modules we're testing here (semver_test and aaa_update_test) // are already installed by static::$modules. $this->container->get('theme_installer')->install(['test_theme']); $this->setReleaseMetadata(__DIR__ . '/../../../../tests/fixtures/release-history/drupal.9.8.2.xml'); $this->setReleaseMetadata(__DIR__ . "/../../fixtures/release-history/$project_name.1.1.xml"); $this->setProjectInstalledVersion([$project_name => $installed_version]); Loading @@ -159,7 +172,7 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { $this->drupalGet('/admin/reports/updates'); $this->clickLink('Update Extensions'); $this->assertTableShowsUpdates( $project_name === 'semver_test' ? 'Semver Test' : 'AAA Update test', $project_title, $installed_version, $target_version ); Loading automatic_updates_extensions/tests/themes/test_theme/test_theme.info.yml 0 → 100644 +11 −0 Original line number Diff line number Diff line name: Test theme type: theme package: Testing description: 'A test theme.' core_version_requirement: ^8 || ^9 base theme: false regions: header: 'Header' content: 'Content' sidebar_first: 'Sidebar first' footer: 'Footer' Loading
automatic_updates_extensions/src/Form/UpdaterForm.php +4 −1 Original line number Diff line number Diff line Loading @@ -232,6 +232,9 @@ final class UpdaterForm extends FormBase { * Modules that require updates. */ private function getRecommendedModuleUpdates(): array { $supported_project_types = [ "module", "module-disabled", "theme", "theme-disabled", ]; $available_updates = update_get_available(TRUE); if (empty($available_updates)) { $this->messenger()->addError('There was a problem getting update information. Try again later.'); Loading @@ -243,7 +246,7 @@ final class UpdaterForm extends FormBase { $installed_packages = array_keys($this->extensionUpdater->getActiveComposer()->getInstalledPackages()); $non_supported_update_statuses = []; foreach ($project_data as $project_name => $project_info) { if ($project_info['project_type'] === 'module' || $project_info['project_type'] === 'module-disabled') { if (in_array($project_info['project_type'], $supported_project_types, TRUE)) { if ($project_info['status'] !== UpdateManagerInterface::CURRENT) { if (!in_array("drupal/$project_name", $installed_packages, TRUE)) { $non_supported_update_statuses[] = $project_info['status']; Loading
automatic_updates_extensions/tests/fixtures/active_composer/two_projects/vendor/composer/installed.json +5 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,11 @@ "name": "drupal/aaa_update_test", "version": "9.8.1", "type": "drupal-module" }, { "name": "drupal/test_theme", "version": "9.8.1", "type": "drupal-theme" } ] }
automatic_updates_extensions/tests/fixtures/release-history/test_theme.1.1.xml 0 → 100644 +119 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <project xmlns:dc="http://purl.org/dc/elements/1.1/"> <title>Test theme</title> <short_name>test_theme</short_name> <dc:creator>drupal</dc:creator> <type>project_theme</type> <supported_branches>8.x-2.,3.0.</supported_branches> <project_status>published</project_status> <link>http://example.com/project/test_theme</link> <terms> <term> <name>Projects</name> <value>Themes</value> </term> <term> <name>Maintenance status</name> <value>Minimally maintained</value> </term> <term> <name>Development status</name> <value>Under active development</value> </term> </terms> <releases> <release> <name>test_theme 3.0.0</name> <version>3.0.0</version> <tag>3.0.0</tag> <status>published</status> <release_link>http://example.com/test_theme/releases/3.0.0</release_link> <download_link>http://example.com/test_theme-3.0.0.tar.gz</download_link> <date>1597793786</date> <files> <file> <url>http://example.com/test_theme-3.0.0.tar.gz</url> <archive_type>tar.gz</archive_type> <md5>43956be126b27d718ecffd0b17244aa1</md5> <size>196080</size> <filedate>1597793786</filedate> </file> <file> <url>http://example.com/test_theme-3.0.0.zip</url> <archive_type>zip</archive_type> <md5>5d24ec88ac4755af6ccbe6ef5ff8b3c9</md5> <size>200399</size> <filedate>1597793786</filedate> </file> </files> <security covered="1">Covered by Drupal's security advisory policy</security> <core_compatibility>^8 || ^9</core_compatibility> </release> <release> <name>test_theme 8.x-2.1</name> <version>8.x-2.1</version> <tag>8.x-2.1</tag> <status>published</status> <release_link>http://example.com/test_theme/releases/8.x-2.1</release_link> <download_link>http://example.com/test_theme-8.x-2.1.tar.gz</download_link> <date>1597793786</date> <files> <file> <url>http://example.com/test_theme-8.x-2.1.tar.gz</url> <archive_type>tar.gz</archive_type> <md5>43956be126b27d718ecffd0b17244aa1</md5> <size>196080</size> <filedate>1597793786</filedate> </file> <file> <url>http://example.com/test_theme-8.x-2.1.zip</url> <archive_type>zip</archive_type> <md5>5d24ec88ac4755af6ccbe6ef5ff8b3c9</md5> <size>200399</size> <filedate>1597793786</filedate> </file> </files> <terms> <term> <name>Release type</name> <value>Bug fixes</value> </term> </terms> <security covered="1">Covered by Drupal's security advisory policy</security> <core_compatibility>8.x</core_compatibility> </release> <release> <name>test_theme 8.x-2.0</name> <version>8.x-2.0</version> <tag>8.x-2.0</tag> <status>published</status> <release_link>http://example.com/test_theme/releases/8.x-2.0</release_link> <download_link>http://example.com/test_theme-8.x-2.0.tar.gz</download_link> <date>1597793786</date> <files> <file> <url>http://example.com/test_theme-8.x-2.0.tar.gz</url> <archive_type>tar.gz</archive_type> <md5>43956be126b27d718ecffd0b17244aa1</md5> <size>196080</size> <filedate>1597793786</filedate> </file> <file> <url>http://example.com/test_theme-8.x-2.0.zip</url> <archive_type>zip</archive_type> <md5>5d24ec88ac4755af6ccbe6ef5ff8b3c9</md5> <size>200399</size> <filedate>1597793786</filedate> </file> </files> <terms> <term> <name>Release type</name> <value>Bug fixes</value> </term> </terms> <security covered="1">Covered by Drupal's security advisory policy</security> <core_compatibility>8.x</core_compatibility> </release> </releases> </project>
automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php +17 −4 Original line number Diff line number Diff line Loading @@ -49,8 +49,15 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { */ public function providerSuccessfulUpdate(): array { return [ 'maintenance mode on, semver' => [TRUE, 'semver_test', '8.1.0', '8.1.1'], 'maintenance mode off, legacy' => [FALSE, 'aaa_update_test', '8.x-2.0', '8.x-2.1'], 'maintenance mode on, semver module' => [ TRUE, 'semver_test', 'Semver Test', '8.1.0', '8.1.1', ], 'maintenance mode off, legacy module' => [ FALSE, 'aaa_update_test', 'AAA Update test', '8.x-2.0', '8.x-2.1', ], 'maintenance mode off, legacy theme' => [ FALSE, 'test_theme', 'Test theme', '8.x-2.0', '8.x-2.1', ], ]; } Loading Loading @@ -134,6 +141,8 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { * Whether maintenance should be on at the beginning of the update. * @param string $project_name * The project name. * @param string $project_title * The project title. * @param string $installed_version * The installed version. * @param string $target_version Loading @@ -141,9 +150,13 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { * * @dataProvider providerSuccessfulUpdate */ public function testSuccessfulUpdate(bool $maintenance_mode_on, string $project_name, string $installed_version, string $target_version): void { public function testSuccessfulUpdate(bool $maintenance_mode_on, string $project_name, string $project_title, string $installed_version, string $target_version): void { $this->container->get('theme_installer')->install(['automatic_updates_theme_with_updates']); $this->updateProject = $project_name; // By default, the Update module only checks for updates of installed modules // and themes. The two modules we're testing here (semver_test and aaa_update_test) // are already installed by static::$modules. $this->container->get('theme_installer')->install(['test_theme']); $this->setReleaseMetadata(__DIR__ . '/../../../../tests/fixtures/release-history/drupal.9.8.2.xml'); $this->setReleaseMetadata(__DIR__ . "/../../fixtures/release-history/$project_name.1.1.xml"); $this->setProjectInstalledVersion([$project_name => $installed_version]); Loading @@ -159,7 +172,7 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { $this->drupalGet('/admin/reports/updates'); $this->clickLink('Update Extensions'); $this->assertTableShowsUpdates( $project_name === 'semver_test' ? 'Semver Test' : 'AAA Update test', $project_title, $installed_version, $target_version ); Loading
automatic_updates_extensions/tests/themes/test_theme/test_theme.info.yml 0 → 100644 +11 −0 Original line number Diff line number Diff line name: Test theme type: theme package: Testing description: 'A test theme.' core_version_requirement: ^8 || ^9 base theme: false regions: header: 'Header' content: 'Content' sidebar_first: 'Sidebar first' footer: 'Footer'