3 namespace Drupal\Tests\system\Functional\Form;
5 use Drupal\Tests\BrowserTestBase;
8 * Tests \Drupal\system\Form\ModulesListForm.
12 class ModulesListFormWebTest extends BrowserTestBase {
17 public static $modules = ['system_test', 'help'];
22 protected function setUp() {
24 \Drupal::state()->set('system_test.module_hidden', FALSE);
28 * Tests the module list form.
30 public function testModuleListForm() {
32 $this->drupalCreateUser(
33 ['administer modules', 'administer permissions']
36 $this->drupalGet('admin/modules');
37 $this->assertResponse('200');
39 // Check that system_test's configure link was rendered correctly.
40 $this->assertFieldByXPath("//a[contains(@href, '/system-test/configure/bar') and text()='Configure ']/span[contains(@class, 'visually-hidden') and text()='the System test module']");
42 // Check that system_test's permissions link was rendered correctly.
43 $this->assertFieldByXPath("//a[contains(@href, '/admin/people/permissions#module-system_test') and @title='Configure permissions']");
45 // Check that system_test's help link was rendered correctly.
46 $this->assertFieldByXPath("//a[contains(@href, '/admin/help/system_test') and @title='Help']");
48 // Ensure that the Testing module's machine name is printed. Testing module
49 // is used because its machine name is different than its human readable
51 $this->assertText('simpletest');