You are here

public function UpdateContribTest::testNoReleasesAvailable in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/update/tests/src/Functional/UpdateContribTest.php \Drupal\Tests\update\Functional\UpdateContribTest::testNoReleasesAvailable()
  2. 10 core/modules/update/tests/src/Functional/UpdateContribTest.php \Drupal\Tests\update\Functional\UpdateContribTest::testNoReleasesAvailable()

Tests when there is no available release data for a contrib module.

File

core/modules/update/tests/src/Functional/UpdateContribTest.php, line 55

Class

UpdateContribTest
Tests how the Update Manager module handles contributed modules and themes in a series of functional tests using mock XML data.

Namespace

Drupal\Tests\update\Functional

Code

public function testNoReleasesAvailable() {
  $system_info = [
    '#all' => [
      'version' => '8.0.0',
    ],
    'aaa_update_test' => [
      'project' => 'aaa_update_test',
      'version' => '8.x-1.0',
      'hidden' => FALSE,
    ],
  ];
  $this
    ->config('update_test.settings')
    ->set('system_info', $system_info)
    ->save();
  $this
    ->refreshUpdateStatus([
    'drupal' => '0.0',
    'aaa_update_test' => 'no-releases',
  ]);
  $this
    ->drupalGet('admin/reports/updates');

  // Cannot use $this->standardTests() because we need to check for the
  // 'No available releases found' string.
  $this
    ->assertRaw('<h3>' . t('Drupal core') . '</h3>');
  $this
    ->assertRaw(Link::fromTextAndUrl(t('Drupal'), Url::fromUri('http://example.com/project/drupal'))
    ->toString());
  $this
    ->assertText(t('Up to date'));
  $this
    ->assertRaw('<h3>' . t('Modules') . '</h3>');
  $this
    ->assertNoText(t('Update available'));
  $this
    ->assertText(t('No available releases found'));
  $this
    ->assertNoRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))
    ->toString());
  $available = update_get_available();
  $this
    ->assertFalse(isset($available['aaa_update_test']['fetch_status']), 'Results are cached even if no releases are available.');
}