You are here

function UpdateContribTest::testNoReleasesAvailable in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/update/src/Tests/UpdateContribTest.php \Drupal\update\Tests\UpdateContribTest::testNoReleasesAvailable()

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

File

core/modules/update/src/Tests/UpdateContribTest.php, line 37
Contains \Drupal\update\Tests\UpdateContribTest.

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\update\Tests

Code

function testNoReleasesAvailable() {
  $system_info = array(
    '#all' => array(
      'version' => '8.0.0',
    ),
    'aaa_update_test' => array(
      'project' => 'aaa_update_test',
      'version' => '8.x-1.0',
      'hidden' => FALSE,
    ),
  );
  $this
    ->config('update_test.settings')
    ->set('system_info', $system_info)
    ->save();
  $this
    ->refreshUpdateStatus(array(
    '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(\Drupal::l(t('Drupal'), Url::fromUri('http://example.com/project/drupal')));
  $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(\Drupal::l(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test')));
  $available = update_get_available();
  $this
    ->assertFalse(isset($available['aaa_update_test']['fetch_status']), 'Results are cached even if no releases are available.');
}