Skip to content
Snippets Groups Projects
Commit 37c07a73 authored by Jess's avatar Jess
Browse files

Issue #2833462 by alexpott, tim.plunkett, Berdir: hook_requirements($phase =...

Issue #2833462 by alexpott, tim.plunkett, Berdir: hook_requirements($phase = 'install') does not work as expected for experimental modules
parent 20982963
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -411,6 +411,7 @@ protected function buildModuleList(FormStateInterface $form_state) {
foreach (array_keys($modules['install']) as $module) {
if (!drupal_check_module($module)) {
unset($modules['install'][$module]);
unset($modules['experimental'][$module]);
foreach (array_keys($data[$module]->required_by) as $dependent) {
unset($modules['install'][$dependent]);
unset($modules['dependencies'][$dependent]);
......
......@@ -120,6 +120,14 @@ public function testExperimentalConfirmForm() {
$this->drupalPostForm(NULL, [], 'Continue');
$this->assertText('2 modules have been enabled: Experimental Test, Experimental Dependency Test');
// Try to enable an experimental module that can not be due to
// hook_requirements().
\Drupal::state()->set('experimental_module_requirements_test_requirements', TRUE);
$edit = [];
$edit["modules[Core (Experimental)][experimental_module_requirements_test][enable]"] = TRUE;
$this->drupalPostForm('admin/modules', $edit, 'Install');
$this->assertUrl('admin/modules', [], 'If the module can not be installed we are not taken to the confirm form.');
$this->assertText('The Experimental Test Requirements module can not be installed.');
}
}
name: 'Experimental Requirements Test'
type: module
description: 'Module in the experimental package to test hook_requirements() with an experimental module.'
package: Core (Experimental)
version: VERSION
core: 8.x
<?php
/**
* @file
* Experimental Test Requirements module to test hook_requirements().
*/
/**
* Implements hook_requirements().
*/
function experimental_module_requirements_test_requirements() {
$requirements = [];
if (\Drupal::state()->get('experimental_module_requirements_test_requirements', FALSE)) {
$requirements['experimental_module_requirements_test_requirements'] = [
'severity' => REQUIREMENT_ERROR,
'description' => t('The Experimental Test Requirements module can not be installed.'),
];
}
return $requirements;
}
<?php
/**
* @file
* Experimental Test Requirements module to test hook_requirements().
*/
/**
* Implements hook_help().
*/
function experimental_module_requirements_test_help($route_name) {
switch ($route_name) {
case 'help.page.experimental_module_requirements_test':
// Make the help text conform to core standards. See
// \Drupal\system\Tests\Module\InstallUninstallTest::assertHelp().
return t('The Experimental Requirements Test module is not done yet. It may eat your data, but you can read the <a href=":url">online documentation for the Experimental Requirements Test module</a>.', [':url' => 'http://www.example.com']);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment