ModulesListFormWebTest.php 1.35 KB
Newer Older
1 2 3 4
<?php

/**
 * @file
5
 * Contains \Drupal\system\Tests\Form\ModulesListFormWebTest.
6 7 8 9 10 11 12 13
 */

namespace Drupal\system\Tests\Form;

use Drupal\simpletest\WebTestBase;

/**
 * Tests \Drupal\system\Form\ModulesListForm.
14 15
 *
 * @group Form
16 17 18 19 20 21
 */
class ModulesListFormWebTest extends WebTestBase {

  /**
   * {@inheritdoc}
   */
22
  public static $modules = array('system_test', 'help');
23 24 25 26

  /**
   * {@inheritdoc}
   */
27
  protected function setUp() {
28 29 30 31 32 33 34 35
    parent::setUp();
    \Drupal::state()->set('system_test.module_hidden', FALSE);
  }

  /**
   * Tests the module list form.
   */
  public function testModuleListForm() {
36 37 38 39 40
    $this->drupalLogin(
      $this->drupalCreateUser(
        array('administer modules', 'administer permissions')
      )
    );
41 42 43 44
    $this->drupalGet('admin/modules');
    $this->assertResponse('200');

    // Check that system_test's configure link was rendered correctly.
45
    $this->assertFieldByXPath("//a[contains(@href, '/system-test/configure/bar') and @title='Bar.bar']");
46 47 48

    // 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']");
49 50 51

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

54
}