function DatetimeElementFormTest::testDatetimeElement

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php \Drupal\KernelTests\Core\Datetime\DatetimeElementFormTest::testDatetimeElement()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php \Drupal\KernelTests\Core\Datetime\DatetimeElementFormTest::testDatetimeElement()
  3. 10 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() : void {
    $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'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.