protected $defaultTheme = 'stark';
public function testFormCheckbox() { // Ensure that the checked state is determined and rendered correctly for
// tricky combinations of default and return values.
foreach ([FALSE, NULL, TRUE, 0, '0', '', 1, '1', 'foobar', '1foobar'
] as $default_value) { // Only values that can be used for array indices are supported for
// #return_value, with the exception of integer 0, which is not supported.
// @see \Drupal\Core\Render\Element\Checkbox::processCheckbox().
foreach (['0', '', 1, '1', 'foobar', '1foobar'
] as $return_value) { $form_array = \Drupal::
formBuilder()->
getForm('\Drupal\form_test\Form\FormTestCheckboxTypeJugglingForm',
$default_value,
$return_value);
$form = \Drupal::
service('renderer'
)->
renderRoot($form_array);
if ($default_value === TRUE
) { $checked = TRUE;
} elseif ($return_value === '0'
) { $checked =
($default_value === '0'
);
} elseif ($return_value === ''
) { $checked =
($default_value === ''
);
} elseif ($return_value === 1 ||
$return_value === '1'
) {