class OptionsDynamicValuesApiTest
Same name and namespace in other branches
- 11.x core/modules/options/tests/src/Kernel/OptionsDynamicValuesApiTest.php \Drupal\Tests\options\Kernel\OptionsDynamicValuesApiTest
- 10 core/modules/options/tests/src/Kernel/OptionsDynamicValuesApiTest.php \Drupal\Tests\options\Kernel\OptionsDynamicValuesApiTest
- 8.9.x core/modules/options/tests/src/Functional/OptionsDynamicValuesApiTest.php \Drupal\Tests\options\Functional\OptionsDynamicValuesApiTest
Tests the options allowed values api.
@group options
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\field\Functional\FieldTestBase implements \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\options\Functional\OptionsDynamicValuesTestBase implements \Drupal\Tests\field\Functional\FieldTestBase
- class \Drupal\Tests\options\Functional\OptionsDynamicValuesApiTest implements \Drupal\Tests\options\Functional\OptionsDynamicValuesTestBase
- class \Drupal\Tests\options\Functional\OptionsDynamicValuesTestBase implements \Drupal\Tests\field\Functional\FieldTestBase
- class \Drupal\Tests\field\Functional\FieldTestBase implements \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of OptionsDynamicValuesApiTest
File
-
core/
modules/ options/ tests/ src/ Functional/ OptionsDynamicValuesApiTest.php, line 10
Namespace
Drupal\Tests\options\FunctionalView source
class OptionsDynamicValuesApiTest extends OptionsDynamicValuesTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests options_allowed_values().
*
* @see options_test_dynamic_values_callback()
*/
public function testOptionsAllowedValues() {
// Test allowed values without passed $items.
$values = options_allowed_values($this->fieldStorage);
$this->assertEquals([], $values);
$values = options_allowed_values($this->fieldStorage, $this->entity);
$expected_values = [
$this->entity
->label(),
$this->entity
->toUrl()
->toString(),
$this->entity
->uuid(),
$this->entity
->bundle(),
];
$expected_values = array_combine($expected_values, $expected_values);
$this->assertEquals($expected_values, $values);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.