function FilterEntityReferenceWebTest::getUiOptions

Helper method to parse options from the UI.

Return value

array Array of keyed arrays containing the id and label of each option.

2 calls to FilterEntityReferenceWebTest::getUiOptions()
FilterEntityReferenceWebTest::testFilterConfigUi in core/modules/views_ui/tests/src/Functional/FilterEntityReferenceWebTest.php
Tests the filter UI for config reference.
FilterEntityReferenceWebTest::testFilterUi in core/modules/views_ui/tests/src/Functional/FilterEntityReferenceWebTest.php
Tests the filter UI.

File

core/modules/views_ui/tests/src/Functional/FilterEntityReferenceWebTest.php, line 134

Class

FilterEntityReferenceWebTest
Tests the entity reference filter UI.

Namespace

Drupal\Tests\views_ui\Functional

Code

protected function getUiOptions() : array {
  /** @var \Behat\Mink\Element\TraversableElement[] $result */
  $result = $this->xpath('//select[@name="options[value][]"]/option');
  $this->assertNotEmpty($result, 'Options found');
  $options = [];
  foreach ($result as $option) {
    $options[] = [
      'id' => (int) $option->getValue(),
      'label' => $option->getText(),
    ];
  }
  return $options;
}

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