Commit e4efc8b8 authored by Yash Rode's avatar Yash Rode Committed by Ted Bowman
Browse files

Issue #3304617 by yash.rode, tedbow: Display readiness checks failure at...

Issue #3304617 by yash.rode, tedbow: Display readiness checks failure at admin/reports/updates/automatic-update
parent 71497518
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -164,6 +164,15 @@ final class UpdaterForm extends FormBase {
      return $form;
    }

    if ($form_state->getUserInput()) {
      $results = [];
    }
    else {
      $event = new ReadinessCheckEvent($this->updater);
      $this->eventDispatcher->dispatch($event);
      $results = $event->getResults();
    }
    $this->displayResults($results, $this->messenger(), $this->renderer);
    $project = $project_info->getProjectInfo();
    if ($installed_minor_release === NULL && $next_minor_release === NULL) {
      if ($project['status'] === UpdateManagerInterface::CURRENT) {
@@ -216,15 +225,6 @@ final class UpdaterForm extends FormBase {
        $release_status = $this->t('Available update');
        $type = 'update-recommended';
    }
    if ($form_state->getUserInput()) {
      $results = [];
    }
    else {
      $event = new ReadinessCheckEvent($this->updater);
      $this->eventDispatcher->dispatch($event);
      $results = $event->getResults();
    }
    $this->displayResults($results, $this->messenger(), $this->renderer);
    $create_update_buttons = !$stage_exists && $this->getOverallSeverity($results) !== SystemManager::REQUIREMENT_ERROR;
    if ($installed_minor_release) {
      $installed_version = ExtensionVersion::createFromVersionString($project_info->getInstalledVersion());
+15 −0
Original line number Diff line number Diff line
@@ -187,6 +187,21 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
    $this->assertUpdateStagedTimes(0);
  }

  /**
   * Tests readiness checks are displayed when there is no update available.
   */
  public function testReadinessCheckFailureWhenNoUpdate() {
    $assert_session = $this->assertSession();
    $this->setCoreVersion('9.8.1');
    $message = "You've not experienced Shakespeare until you have read him in the original Klingon.";
    $result = ValidationResult::createError([$message]);
    TestSubscriber1::setTestResult([$result], ReadinessCheckEvent::class);
    $this->checkForUpdates();
    $this->drupalGet('/admin/reports/updates/automatic-update');
    $assert_session->pageTextContains('No update available');
    $assert_session->pageTextContains($message);
  }

  /**
   * Checks the table for a release on the form.
   *