You are here

public function HandlerTest::assertNoDuplicateField in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views_ui/src/Tests/HandlerTest.php \Drupal\views_ui\Tests\HandlerTest::assertNoDuplicateField()

Asserts that fields only appear once.

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/src/Tests/HandlerTest.php
Ensures that neither node type or node ID appears multiple times.

File

core/modules/views_ui/src/Tests/HandlerTest.php, line 257
Contains \Drupal\views_ui\Tests\HandlerTest.

Class

HandlerTest
Tests handler UI for views.

Namespace

Drupal\views_ui\Tests

Code

public function assertNoDuplicateField($field_name, $entity_type) {
  $elements = $this
    ->xpath('//td[.=:entity_type]/preceding-sibling::td[@class="title" and .=:title]', [
    ':title' => $field_name,
    ':entity_type' => $entity_type,
  ]);
  $this
    ->assertEqual(1, count($elements), $field_name . ' appears just once in ' . $entity_type . '.');
}