You are here

public function FilterUITest::testFiltersUI in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/views_ui/src/Tests/FilterUITest.php \Drupal\views_ui\Tests\FilterUITest::testFiltersUI()

Tests the filters from the UI.

File

core/modules/views_ui/src/Tests/FilterUITest.php, line 69
Contains \Drupal\views_ui\Tests\FilterUITest.

Class

FilterUITest
Tests for the filters from the UI.

Namespace

Drupal\views_ui\Tests

Code

public function testFiltersUI() {
  $admin_user = $this
    ->drupalCreateUser(array(
    'administer views',
    'administer site configuration',
  ));
  $this
    ->drupalLogin($admin_user);
  $this
    ->drupalGet('admin/structure/views/view/test_filter_groups');
  $this
    ->assertLink('Content: Node ID (= 1)', 0, 'Content: Node ID (= 1) link appears correctly.');

  // Tests that we can create a new filter group from UI.
  $this
    ->drupalGet('admin/structure/views/nojs/rearrange-filter/test_filter_groups/page');
  $this
    ->assertNoRaw('<span>Group 3</span>', 'Group 3 has not been added yet.');

  // Create 2 new groups.
  $this
    ->drupalPostForm(NULL, [], t('Create new filter group'));
  $this
    ->drupalPostForm(NULL, [], t('Create new filter group'));

  // Remove the new group 3.
  $this
    ->drupalPostForm(NULL, [], t('Remove group 3'));

  // Verify that the group 4 is now named as 3.
  $this
    ->assertRaw('<span>Group 3</span>', 'Group 3 still exists.');

  // Remove the group 3 again.
  $this
    ->drupalPostForm(NULL, [], t('Remove group 3'));

  // Group 3 now does not exist.
  $this
    ->assertNoRaw('<span>Group 3</span>', 'Group 3 has not been added yet.');
}