diff --git a/core/modules/datetime/src/Tests/DateTimeFormInjectionTest.php b/core/modules/datetime/src/Tests/DateTimeFormInjectionTest.php new file mode 100644 index 0000000..150c909 --- /dev/null +++ b/core/modules/datetime/src/Tests/DateTimeFormInjectionTest.php @@ -0,0 +1,119 @@ + 'datelist test', + '#type' => 'datelist', + '#default_value' => new DrupalDateTime('2000-01-01 00:00:00'), + '#date_part_order' => array( + 'month', + 'day', + 'year', + 'hour', + 'minute', 'ampm', + ), + '#date_text_parts' => array('year'), + '#date_year_range' => '2010:2020', + '#date_increment' => 15, + ); + $form['#process'][] = [$this, 'process']; + return $form; + } + + /** + * {@inheritdoc} + */ + public function validateForm(array &$form, FormStateInterface $form_state) {} + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + $this->assertTrue(TRUE); + $form_state->setRebuild(); + } + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + $this->installSchema('system', ['key_value_expire', 'sequences']); + } + + /** + * Tests db log injection serialization. + */ + public function testDatetimeSerialization() { + $form_state = new FormState(); + $form_state->setRequestMethod('POST'); + $form_state->setCached(); + $form_builder = $this->container->get('form_builder'); + $form_id = $form_builder->getFormId($this, $form_state); + $form = $form_builder->retrieveForm($form_id, $form_state); + $form_builder->prepareForm($form_id, $form, $form_state); + $form_builder->processForm($form_id, $form, $form_state); + } + +}