Skip to content
Snippets Groups Projects
Commit 0b631e97 authored by Rahul Gupta's avatar Rahul Gupta Committed by Adam G-H
Browse files

Issue #3300036 by rahul_, tedbow: Automatic Updates Extensions only shows...

Issue #3300036 by rahul_, tedbow: Automatic Updates Extensions only shows module updates, not themes
parent 72862dfc
No related branches found
No related tags found
No related merge requests found
......@@ -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.');
......@@ -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'];
......
......@@ -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"
}
]
}
<?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>
......@@ -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',
],
];
}
......@@ -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
......@@ -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]);
......@@ -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
);
......
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'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment