function EntityReferenceAdminTest::assertFieldSelectOptions
Checks if a select element contains the specified options.
@internal
Parameters
string $name: The field name.
array $expected_options: An array of expected options.
1 call to EntityReferenceAdminTest::assertFieldSelectOptions()
- EntityReferenceAdminTest::testAvailableFormatters in core/
modules/ field/ tests/ src/ Functional/ EntityReference/ EntityReferenceAdminTest.php - Tests the formatters for the Entity References.
File
-
core/
modules/ field/ tests/ src/ Functional/ EntityReference/ EntityReferenceAdminTest.php, line 423
Class
- EntityReferenceAdminTest
- Tests for the administrative UI.
Namespace
Drupal\Tests\field\Functional\EntityReferenceCode
protected function assertFieldSelectOptions(string $name, array $expected_options) : void {
$options = $this->assertSession()
->selectExists($name)
->findAll('xpath', 'option');
array_walk($options, function (NodeElement &$option) {
$option = $option->getValue();
});
$this->assertEqualsCanonicalizing($expected_options, $options);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.