You are here

public function ConfigInspectorUITest::testConfigInspectorListUi in Configuration Inspector 8

Tests the listing page for inspecting configuration.

File

tests/src/Functional/ConfigInspectorUITest.php, line 42

Class

ConfigInspectorUITest
User interface tests for configuration inspector.

Namespace

Drupal\Tests\config_inspector\Functional

Code

public function testConfigInspectorListUi() {
  $this
    ->drupalGet('admin/reports/config-inspector');
  $this
    ->assertSession()
    ->responseContains('user.role.anonymous');
  foreach ([
    'list',
    'tree',
    'form',
    'raw',
  ] as $type) {
    $this
      ->assertSession()
      ->linkByHrefExists('admin/reports/config-inspector/user.role.anonymous/' . $type);
  }
  foreach ([
    'list',
    'tree',
    'form',
    'raw',
  ] as $type) {
    $this
      ->drupalGet('admin/reports/config-inspector/user.role.anonymous/' . $type);
    $this
      ->assertSession()
      ->pageTextContains('Label');

    // Assert this as raw text, so we can find even as form default value.
    $this
      ->assertSession()
      ->responseContains('Anonymous user');

    // Make sure the tabs are present.
    $this
      ->assertSession()
      ->linkExists('List');
    $this
      ->assertSession()
      ->linkExists('Tree');
    $this
      ->assertSession()
      ->linkExists('Form');
    $this
      ->assertSession()
      ->linkExists('Raw data');
  }
}