From 50118645acdeb630760266a814ee84f7a87e1bc0 Mon Sep 17 00:00:00 2001 From: Moshe Weitzman Date: Sat, 30 Oct 2021 06:45:35 -0400 Subject: [PATCH] pm:enable should fail by default if hook_requirements() is not met (#4874) --- src/Drupal/Commands/pm/PmCommands.php | 4 ++-- tests/functional/PmEnDisUnListInfoTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Drupal/Commands/pm/PmCommands.php b/src/Drupal/Commands/pm/PmCommands.php index bdd65afdff..23a0acb647 100644 --- a/src/Drupal/Commands/pm/PmCommands.php +++ b/src/Drupal/Commands/pm/PmCommands.php @@ -150,8 +150,8 @@ public function validateEnableModules(CommandData $commandData) } if ($error) { - // Let the user confirm the installation if the requirements are unmet. - if (!$this->io()->confirm(dt('The module install requirements failed. Do you wish to continue?'))) { + // Allow the user to bypass the install requirements. + if (!$this->io()->confirm(dt('The module install requirements failed. Do you wish to continue?'), false)) { throw new UserAbortException(); } } diff --git a/tests/functional/PmEnDisUnListInfoTest.php b/tests/functional/PmEnDisUnListInfoTest.php index 797f91ef67..4eff2dad93 100644 --- a/tests/functional/PmEnDisUnListInfoTest.php +++ b/tests/functional/PmEnDisUnListInfoTest.php @@ -27,7 +27,7 @@ public function testEnDisUnList() // Test that pm-enable does not install a module if the install // requirements are not met. - $this->drush('pm-enable', ['drush_empty_module'], ['no' => null], null, null, self::EXIT_ERROR, null, [ + $this->drush('pm-enable', ['drush_empty_module'], [], null, null, self::EXIT_ERROR, null, [ 'UNISH_FAIL_INSTALL_REQUIREMENTS' => 'drush_empty_module', ]); $err = $this->getErrorOutput();