function UpdateTestBase::refreshUpdateStatus

Same name and namespace in other branches
  1. 8.9.x core/modules/update/src/Tests/UpdateTestBase.php \Drupal\update\Tests\UpdateTestBase::refreshUpdateStatus()
  2. 11.x core/modules/update/tests/src/Functional/UpdateTestBase.php \Drupal\Tests\update\Functional\UpdateTestBase::refreshUpdateStatus()
  3. 10 core/modules/update/tests/src/Functional/UpdateTestBase.php \Drupal\Tests\update\Functional\UpdateTestBase::refreshUpdateStatus()
  4. 9 core/modules/update/tests/src/Functional/UpdateTestBase.php \Drupal\Tests\update\Functional\UpdateTestBase::refreshUpdateStatus()
  5. 8.9.x core/modules/update/tests/src/Functional/UpdateTestBase.php \Drupal\Tests\update\Functional\UpdateTestBase::refreshUpdateStatus()

Refreshes the update status based on the desired available update scenario.

Parameters

array $xml_map: Array that maps project names to availability scenarios to fetch. The key '#all' is used if a project-specific mapping is not defined.

string $url: (optional) A string containing the URL to fetch update data from. Defaults to 'update-test'.

bool $ui_only: Whether to refresh the update status data entirely via the user interface.

See also

\Drupal\update_test\Controller\UpdateTestController::updateTest()

15 calls to UpdateTestBase::refreshUpdateStatus()
UpdateContribTest::doTestSecurityUpdateAvailability in core/modules/update/tests/src/Functional/UpdateContribTest.php
Tests update status of security releases.
UpdateContribTest::testCoreCompatibilityMessage in core/modules/update/tests/src/Functional/UpdateContribTest.php
Tests that core compatibility messages are displayed.
UpdateContribTest::testHookUpdateStatusAlter in core/modules/update/tests/src/Functional/UpdateContribTest.php
Checks that hook_update_status_alter() works to change a status.
UpdateContribTest::testNonStandardVersionStrings in core/modules/update/tests/src/Functional/UpdateContribTest.php
Tests messages for invalid, empty and missing version strings.
UpdateContribTest::testNoReleasesAvailable in core/modules/update/tests/src/Functional/UpdateContribTest.php
Tests when there is no available release data for a contrib module.

... See full list

1 method overrides UpdateTestBase::refreshUpdateStatus()
UpdateSemverTestBase::refreshUpdateStatus in core/modules/update/tests/src/Functional/UpdateSemverTestBase.php

File

core/modules/update/tests/src/Functional/UpdateTestBase.php, line 80

Class

UpdateTestBase
Defines some shared functions used by all update tests.

Namespace

Drupal\Tests\update\Functional

Code

protected function refreshUpdateStatus(array $xml_map, string $url = 'update-test', bool $ui_only = FALSE) {
  // Tell the Update Status module to fetch from the URL provided by
  // update_test module.
  $this->config('update.settings')
    ->set('fetch.url', Url::fromUri('base:' . $url, [
    'absolute' => TRUE,
  ])->toString())
    ->save();
  // Save the map for UpdateTestController::updateTest() to use.
  $this->mockReleaseHistory($xml_map);
  if ($ui_only) {
    $this->drupalGet('admin/reports/updates');
    $this->clickLink('Check manually');
    $this->checkForMetaRefresh();
  }
  else {
    \Drupal::service('update.manager')->refreshUpdateData();
    \Drupal::service('update.processor')->fetchData();
    $this->drupalGet('admin/reports/updates');
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.