function OptionsSelectDynamicValuesTest::testSelectListDynamic
Same name in other branches
- 9 core/modules/options/tests/src/Functional/OptionsSelectDynamicValuesTest.php \Drupal\Tests\options\Functional\OptionsSelectDynamicValuesTest::testSelectListDynamic()
- 8.9.x core/modules/options/tests/src/Functional/OptionsSelectDynamicValuesTest.php \Drupal\Tests\options\Functional\OptionsSelectDynamicValuesTest::testSelectListDynamic()
- 10 core/modules/options/tests/src/Functional/OptionsSelectDynamicValuesTest.php \Drupal\Tests\options\Functional\OptionsSelectDynamicValuesTest::testSelectListDynamic()
Tests the 'options_select' widget (single select).
File
-
core/
modules/ options/ tests/ src/ Functional/ OptionsSelectDynamicValuesTest.php, line 22
Class
- OptionsSelectDynamicValuesTest
- Tests an options select with a dynamic allowed values function.
Namespace
Drupal\Tests\options\FunctionalCode
public function testSelectListDynamic() : void {
// Create an entity.
$this->entity
->save();
// Create a web user.
$web_user = $this->drupalCreateUser([
'view test entity',
'administer entity_test content',
]);
$this->drupalLogin($web_user);
// Display form.
$this->drupalGet('entity_test_rev/manage/' . $this->entity
->id() . '/edit');
$options = $this->assertSession()
->selectExists('edit-test-options')
->findAll('css', 'option');
$this->assertCount(count($this->test) + 1, $options);
foreach ($options as $option) {
$value = $option->getValue();
if ($value != '_none') {
$this->assertContains($value, $this->test);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.