You are here

public function UpdateContribTest::testNoReleasesAvailable in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/update/tests/src/Functional/UpdateContribTest.php \Drupal\Tests\update\Functional\UpdateContribTest::testNoReleasesAvailable()
  2. 9 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 53

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',
  ]);

  // Cannot use $this->standardTests() because we need to check for the
  // 'No available releases found' string.
  $this
    ->assertSession()
    ->responseContains('<h3>Drupal core</h3>');
  $this
    ->assertSession()
    ->linkExists('Drupal');
  $this
    ->assertSession()
    ->linkByHrefExists('http://example.com/project/drupal');
  $this
    ->assertSession()
    ->pageTextContains('Up to date');
  $this
    ->assertSession()
    ->responseContains('<h3>Modules</h3>');
  $this
    ->assertSession()
    ->pageTextNotContains('Update available');
  $this
    ->assertSession()
    ->pageTextContains('No available releases found');
  $this
    ->assertSession()
    ->linkNotExists('AAA Update test');
  $this
    ->assertSession()
    ->linkByHrefNotExists('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.');
}