function OptionsFieldUIAllowedValuesTest::assertOrder

Same name in other branches
  1. 10 core/modules/options/tests/src/FunctionalJavascript/OptionsFieldUIAllowedValuesTest.php \Drupal\Tests\options\FunctionalJavascript\OptionsFieldUIAllowedValuesTest::assertOrder()

Asserts the order of provided option list on admin path.

Parameters

array $expected: Expected order.

bool $is_string_option: Whether the request is for string option list.

1 call to OptionsFieldUIAllowedValuesTest::assertOrder()
OptionsFieldUIAllowedValuesTest::testOptionsAllowedValues in core/modules/options/tests/src/FunctionalJavascript/OptionsFieldUIAllowedValuesTest.php
Tests option types allowed values.

File

core/modules/options/tests/src/FunctionalJavascript/OptionsFieldUIAllowedValuesTest.php, line 221

Class

OptionsFieldUIAllowedValuesTest
Tests the Options field allowed values UI functionality.

Namespace

Drupal\Tests\options\FunctionalJavascript

Code

protected function assertOrder($expected, $is_string_option) {
    $page = $this->getSession()
        ->getPage();
    if ($is_string_option) {
        $inputs = $page->findAll('css', '.draggable .form-text.machine-name-source');
    }
    else {
        $inputs = $page->findAll('css', '.draggable .form-text');
    }
    foreach ($expected as $step => $expected_input_value) {
        $value = $inputs[$step]->getValue();
        $this->assertSame($expected_input_value, $value, "Item {$step} should be {$expected_input_value}, but got {$value}");
    }
}

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