You are here

public function ModulesListFormWebTest::testModuleListForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Form/ModulesListFormWebTest.php \Drupal\system\Tests\Form\ModulesListFormWebTest::testModuleListForm()

Tests the module list form.

File

core/modules/system/src/Tests/Form/ModulesListFormWebTest.php, line 35
Contains \Drupal\system\Tests\Form\ModulesListFormWebTest.

Class

ModulesListFormWebTest
Tests \Drupal\system\Form\ModulesListForm.

Namespace

Drupal\system\Tests\Form

Code

public function testModuleListForm() {
  $this
    ->drupalLogin($this
    ->drupalCreateUser(array(
    'administer modules',
    'administer permissions',
  )));
  $this
    ->drupalGet('admin/modules');
  $this
    ->assertResponse('200');

  // Check that system_test's configure link was rendered correctly.
  $this
    ->assertFieldByXPath("//a[contains(@href, '/system-test/configure/bar') and text()='Configure ']/span[contains(@class, 'visually-hidden') and text()='the System test module']");

  // Check that system_test's permissions link was rendered correctly.
  $this
    ->assertFieldByXPath("//a[contains(@href, '/admin/people/permissions#module-system_test') and @title='Configure permissions']");

  // Check that system_test's help link was rendered correctly.
  $this
    ->assertFieldByXPath("//a[contains(@href, '/admin/help/system_test') and @title='Help']");

  // Ensure that the Testing module's machine name is printed. Testing module
  // is used because its machine name is different than its human readable
  // name.
  $this
    ->assertText('simpletest');
}