function HandlerTest::assertNoDuplicateField

Same name in other branches
  1. 8.9.x core/modules/views_ui/tests/src/Functional/HandlerTest.php \Drupal\Tests\views_ui\Functional\HandlerTest::assertNoDuplicateField()
  2. 10 core/modules/views_ui/tests/src/Functional/HandlerTest.php \Drupal\Tests\views_ui\Functional\HandlerTest::assertNoDuplicateField()
  3. 11.x core/modules/views_ui/tests/src/Functional/HandlerTest.php \Drupal\Tests\views_ui\Functional\HandlerTest::assertNoDuplicateField()

Asserts that fields only appear once.

@internal

Parameters

string $field_name: The field name.

string $entity_type: The entity type to which the field belongs.

1 call to HandlerTest::assertNoDuplicateField()
HandlerTest::testNoDuplicateFields in core/modules/views_ui/tests/src/Functional/HandlerTest.php
Ensures that neither node type or node ID appears multiple times.

File

core/modules/views_ui/tests/src/Functional/HandlerTest.php, line 300

Class

HandlerTest
Tests handler UI for views.

Namespace

Drupal\Tests\views_ui\Functional

Code

public function assertNoDuplicateField(string $field_name, string $entity_type) : void {
    $this->assertSession()
        ->elementsCount('xpath', '//td[.="' . $entity_type . '"]/preceding-sibling::td[@class="title" and .="' . $field_name . '"]', 1);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.