function UpdateContribTest::testUpdateContribBasic

Same name in other branches
  1. 9 core/modules/update/tests/src/Functional/UpdateContribTest.php \Drupal\Tests\update\Functional\UpdateContribTest::testUpdateContribBasic()
  2. 8.9.x core/modules/update/tests/src/Functional/UpdateContribTest.php \Drupal\Tests\update\Functional\UpdateContribTest::testUpdateContribBasic()
  3. 10 core/modules/update/tests/src/Functional/UpdateContribTest.php \Drupal\Tests\update\Functional\UpdateContribTest::testUpdateContribBasic()

Tests the basic functionality of a contrib module on the status report.

File

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

Class

UpdateContribTest
Tests how the Update Manager handles contributed modules and themes.

Namespace

Drupal\Tests\update\Functional

Code

public function testUpdateContribBasic() : void {
    $installed_extensions = [
        'aaa_update_test' => [
            'project' => 'aaa_update_test',
            'version' => '8.x-1.0',
            'hidden' => FALSE,
        ],
    ];
    $this->mockInstalledExtensionsInfo($installed_extensions);
    $this->mockDefaultExtensionsInfo([
        'version' => '8.0.0',
    ]);
    $this->refreshUpdateStatus([
        'drupal' => '8.0.0',
        'aaa_update_test' => '1_0',
    ]);
    $this->standardTests();
    $this->assertSession()
        ->pageTextContains('Up to date');
    $this->assertSession()
        ->responseContains('<h3>Modules</h3>');
    $this->assertSession()
        ->pageTextNotContains('Update available');
    $this->assertSession()
        ->linkExists('AAA Update test');
    $this->assertSession()
        ->linkByHrefExists('http://example.com/project/aaa_update_test');
    // Since aaa_update_test is installed the fact it is hidden and in the
    // Testing package means it should not appear.
    $installed_extensions['aaa_update_test']['hidden'] = TRUE;
    $this->mockInstalledExtensionsInfo($installed_extensions);
    $this->mockDefaultExtensionsInfo([
        'version' => '8.0.0',
    ]);
    $this->refreshUpdateStatus([
        'drupal' => '8.0.0',
        'aaa_update_test' => '1_0',
    ]);
    $this->assertSession()
        ->linkNotExists('AAA Update test');
    $this->assertSession()
        ->linkByHrefNotExists('http://example.com/project/aaa_update_test');
    // A hidden and installed project not in the Testing package should appear.
    $installed_extensions['aaa_update_test']['package'] = 'aaa_update_test';
    $this->mockInstalledExtensionsInfo($installed_extensions);
    $this->mockDefaultExtensionsInfo([
        'version' => '8.0.0',
    ]);
    $this->refreshUpdateStatus([
        'drupal' => '8.0.0',
        'aaa_update_test' => '1_0',
    ]);
    $this->assertSession()
        ->linkExists('AAA Update test');
    $this->assertSession()
        ->linkByHrefExists('http://example.com/project/aaa_update_test');
}

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