You are here

public function UpdateCoreTest::testNoUpdatesAvailable in Drupal 8

Tests the Update Manager module when no updates are available.

The XML fixture file 'drupal.1.0.xml' which is one of the XML files this test uses also contains 2 extra releases that are newer than '8.0.1'. These releases will not show as available updates because of the following reasons:

  • '8.0.2' is an unpublished release.
  • '8.0.3' is marked as 'Release type' 'Unsupported'.

File

core/modules/update/tests/src/Functional/UpdateCoreTest.php, line 77

Class

UpdateCoreTest
Tests the Update Manager module through a series of functional tests using mock XML data.

Namespace

Drupal\Tests\update\Functional

Code

public function testNoUpdatesAvailable() {
  foreach ([
    0,
    1,
  ] as $minor_version) {
    foreach ([
      0,
      1,
    ] as $patch_version) {
      foreach ([
        '-alpha1',
        '-beta1',
        '',
      ] as $extra_version) {
        $this
          ->setSystemInfo("8.{$minor_version}.{$patch_version}" . $extra_version);
        $this
          ->refreshUpdateStatus([
          'drupal' => "{$minor_version}.{$patch_version}" . $extra_version,
        ]);
        $this
          ->standardTests();

        // The XML test fixtures for this method all contain the '8.2.0'
        // release but because '8.2.0' is not in a supported branch it will
        // not be in the available updates.
        $this
          ->assertNoRaw('8.2.0');
        $this
          ->assertText(t('Up to date'));
        $this
          ->assertNoText(t('Update available'));
        $this
          ->assertNoText(t('Security update required!'));
        $this
          ->assertRaw('check.svg', 'Check icon was found.');
      }
    }
  }
}