You are here

public function DatetimeElementFormTest::testDatetimeElement in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php \Drupal\KernelTests\Core\Datetime\DatetimeElementFormTest::testDatetimeElement()
  2. 9 core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php \Drupal\KernelTests\Core\Datetime\DatetimeElementFormTest::testDatetimeElement()

Tests that default handlers are added even if custom are specified.

File

core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php, line 135

Class

DatetimeElementFormTest
Tests DatetimeElement functionality.

Namespace

Drupal\KernelTests\Core\Datetime

Code

public function testDatetimeElement() {
  $form_state = new FormState();
  $form = \Drupal::formBuilder()
    ->buildForm($this, $form_state);
  $this
    ->render($form);
  $this
    ->assertTrue($form['datetime_element']['datetimeDateCallbackExecuted']['#value']);
  $this
    ->assertTrue($form['datetime_element']['timeCallbackExecuted']['#value']);
  $this
    ->assertTrue($form_state
    ->get('datetimeDateCallbackExecuted'));
  $this
    ->assertTrue($form_state
    ->get('timeCallbackExecuted'));
}