
| Current Path : /var/www/html1/bbp/web/core/modules/options/tests/src/Functional/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html1/bbp/web/core/modules/options/tests/src/Functional/OptionsSelectDynamicValuesTest.php |
<?php
namespace Drupal\Tests\options\Functional;
/**
* Tests an options select with a dynamic allowed values function.
*
* @group options
*/
class OptionsSelectDynamicValuesTest extends OptionsDynamicValuesTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests the 'options_select' widget (single select).
*/
public function testSelectListDynamic() {
// 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->xpath('//select[@id="edit-test-options"]/option');
$options_expected_count = count($this->test) + 1;
$this->assertCount($options_expected_count, $options);
foreach ($options as $option) {
$value = $option->getValue();
if ($value != '_none') {
$this->assertContains($value, $this->test);
}
}
}
}