dc63e64d72d8cf623d6202d26f828082dca1c7a6
[yaffs-website] / web / core / modules / system / tests / src / Functional / Form / ModulesListFormWebTest.php
1 <?php
2
3 namespace Drupal\Tests\system\Functional\Form;
4
5 use Drupal\Tests\BrowserTestBase;
6
7 /**
8  * Tests \Drupal\system\Form\ModulesListForm.
9  *
10  * @group Form
11  */
12 class ModulesListFormWebTest extends BrowserTestBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   public static $modules = ['system_test', 'help'];
18
19   /**
20    * {@inheritdoc}
21    */
22   protected function setUp() {
23     parent::setUp();
24     \Drupal::state()->set('system_test.module_hidden', FALSE);
25   }
26
27   /**
28    * Tests the module list form.
29    */
30   public function testModuleListForm() {
31     $this->drupalLogin(
32       $this->drupalCreateUser(
33         ['administer modules', 'administer permissions']
34       )
35     );
36     $this->drupalGet('admin/modules');
37     $this->assertResponse('200');
38
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']");
41
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']");
44
45     // Check that system_test's help link was rendered correctly.
46     $this->assertFieldByXPath("//a[contains(@href, '/admin/help/system_test') and @title='Help']");
47
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
50     // name.
51     $this->assertText('simpletest');
52   }
53
54 }