public function WeightTest::testProcessWeight in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/Render/Element/WeightTest.php \Drupal\KernelTests\Core\Render\Element\WeightTest::testProcessWeight()
- 10 core/tests/Drupal/KernelTests/Core/Render/Element/WeightTest.php \Drupal\KernelTests\Core\Render\Element\WeightTest::testProcessWeight()
Test existing #default_value value in #options list.
@covers ::processWeight
File
- core/
tests/ Drupal/ KernelTests/ Core/ Render/ Element/ WeightTest.php, line 35
Class
- WeightTest
- @coversDefaultClass \Drupal\Core\Render\Element\Weight @group Render
Namespace
Drupal\KernelTests\Core\Render\ElementCode
public function testProcessWeight() {
$element = [];
$form_state = new FormState();
$complete_form = [];
$element_object = new Weight([], 'weight', []);
$info = $element_object
->getInfo();
$element += $info;
$element['#default_value'] = $element['#delta'] + 5;
Weight::processWeight($element, $form_state, $complete_form);
$this
->assertTrue(isset($element['#options'][$element['#default_value']]), 'Default value exists in the #options list');
}