function UpdateContribTest::testNoReleasesAvailable

Same name in other branches
  1. 8.9.x 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()
  3. 11.x 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 handles contributed modules and themes.

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.');
}

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