function ModulesListFormWebTest::testModuleListForm

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php \Drupal\Tests\system\Functional\Form\ModulesListFormWebTest::testModuleListForm()
  2. 8.9.x core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php \Drupal\Tests\system\Functional\Form\ModulesListFormWebTest::testModuleListForm()
  3. 10 core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php \Drupal\Tests\system\Functional\Form\ModulesListFormWebTest::testModuleListForm()

Tests the module list form.

File

core/modules/system/tests/src/Functional/Form/ModulesListFormWebTest.php, line 44

Class

ModulesListFormWebTest
Tests <a href="/api/drupal/core%21modules%21system%21src%21Form%21ModulesListForm.php/class/ModulesListForm/11.x" title="Provides module installation interface." class="local">\Drupal\system\Form\ModulesListForm</a>.

Namespace

Drupal\Tests\system\Functional\Form

Code

public function testModuleListForm() : void {
    $this->drupalGet('admin/modules');
    // Check that system_test's configure link was rendered correctly.
    $this->assertSession()
        ->elementExists('xpath', "//a[contains(@href, '/system-test/configure/bar') and text()='Configure ']/span[contains(@class, 'visually-hidden') and text()='System test']");
    // Check that system_test's permissions link was rendered correctly.
    $this->assertSession()
        ->elementExists('xpath', "//a[contains(@href, '/admin/people/permissions/module/system_test') and text()='Permissions ']/span[contains(@class, 'visually-hidden') and text()='for System test']");
    // Check that system_test's help link was rendered correctly.
    $this->assertSession()
        ->elementExists('xpath', "//a[contains(@href, '/admin/help/system_test') and text()='Help ']/span[contains(@class, 'visually-hidden') and text()='for System test']");
    // Ensure that the Database Logging module's machine name is printed. This
    // module is used because its machine name is different than its human
    // readable name.
    $this->assertSession()
        ->pageTextContains('dblog');
    // Check that the deprecated module link was rendered correctly.
    $this->assertSession()
        ->elementExists('xpath', "//a[contains(@aria-label, 'View information on the Deprecated status of the module Deprecated module')]");
    $this->assertSession()
        ->elementExists('xpath', "//a[contains(@href, 'http://example.com/deprecated')]");
    // Check that obsolete modules are not displayed.
    $this->assertSession()
        ->pageTextNotContains('(Obsolete)');
}

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