diff --git a/automatic_updates_extensions/src/Form/UpdaterForm.php b/automatic_updates_extensions/src/Form/UpdaterForm.php index 7b73ad19b892e52ceaf8a19280e72590cea84fdf..24ec72e571adc967a75fed74402685bfce48247c 100644 --- a/automatic_updates_extensions/src/Form/UpdaterForm.php +++ b/automatic_updates_extensions/src/Form/UpdaterForm.php @@ -136,6 +136,8 @@ final class UpdaterForm extends FormBase { '#options' => $options, '#empty' => $this->t('There are no available updates.'), '#attributes' => ['class' => ['update-recommended']], + '#required' => TRUE, + '#required_error' => t('Please select one or more projects.'), ]; if ($form_state->getUserInput()) { diff --git a/automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php b/automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php index 0457f014a4f4de3f6183f9713eee9174d7705728..70d5ce61b259f1926a9e8eb1efa75292c01050b4 100644 --- a/automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php +++ b/automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php @@ -163,13 +163,18 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { $installed_version, $target_version ); + // Submit without selecting a project. + $page->pressButton('Update'); + $assert_session = $this->assertSession(); + $assert_session->pageTextContains('Please select one or more projects.'); + + // Submit with a project selected. $page->checkField('projects[' . $this->updateProject . ']'); $page->pressButton('Update'); $this->checkForMetaRefresh(); $this->assertUpdateStagedTimes(1); // Confirm that the site was put into maintenance mode if needed. $this->assertSame($state->get('system.maintenance_mode'), $maintenance_mode_on); - $assert_session = $this->assertSession(); $possible_update_message = 'Possible database updates were detected in the following extensions; you may be redirected to the database update page in order to complete the update process.'; $assert_session->pageTextContains($possible_update_message); $assert_session->pageTextContainsOnce('System');