OptionsDynamicValuesValidationTest.php in Zircon Profile 8
File
core/modules/options/src/Tests/OptionsDynamicValuesValidationTest.php
View source
<?php
namespace Drupal\options\Tests;
class OptionsDynamicValuesValidationTest extends OptionsDynamicValuesTestBase {
function testDynamicAllowedValues() {
foreach ($this->test as $key => $value) {
$this->entity->test_options->value = $value;
$violations = $this->entity->test_options
->validate();
$this
->assertEqual(count($violations), 0, "{$key} is a valid value");
}
foreach ($this->test as $key => $value) {
$this->entity->test_options->value = is_numeric($value) ? 100 - $value : 'X' . $value;
$violations = $this->entity->test_options
->validate();
$this
->assertEqual(count($violations), 1, "{$key} is not a valid value");
}
}
}