3 namespace Drupal\KernelTests\Core\Render\Element;
5 use Drupal\Core\Form\FormState;
6 use Drupal\Core\Render\Element\Weight;
7 use Drupal\KernelTests\KernelTestBase;
10 * @coversDefaultClass \Drupal\Core\Render\Element\Weight
13 class WeightTest extends KernelTestBase {
18 protected static $modules = ['system'];
23 protected function setUp() {
25 $this->installConfig(['system']);
29 * Test existing #default_value value in #options list.
31 * @covers ::processWeight
33 public function testProcessWeight() {
35 $form_state = new FormState();
38 $element_object = new Weight([], 'weight', []);
39 $info = $element_object->getInfo();
42 $element['#default_value'] = $element['#delta'] + 5;
44 Weight::processWeight($element, $form_state, $complete_form);
47 isset($element['#options'][$element['#default_value']]),
48 'Default value exists in the #options list'