public function DatetimeWidgetTest::testNoDefault in Typed Data API enhancements 8
@covers Drupal\typed_data\Widget\FormWidgetBase::createDefaultDateTime
File
- tests/
src/ Functional/ TypedDataFormWidget/ DatetimeWidgetTest.php, line 143
Class
- DatetimeWidgetTest
- Class DatetimeWidgetTest.
Namespace
Drupal\Tests\typed_data\Functional\TypedDataFormWidgetCode
public function testNoDefault() {
$context_definition = ContextDefinition::create('datetime_iso8601')
->setLabel('Test Example Date and Time');
$this->container
->get('state')
->set('typed_data_widgets.definition', $context_definition);
$path = 'admin/config/user-interface/typed-data-widgets/' . $this->widget
->getPluginId();
$this
->drupalGet($path);
/** @var \Drupal\Tests\WebAssert $assert */
$assert = $this
->assertSession();
// Check that empty date and 12:00:00 for the time are shown when no default
// is specified in the configuration.
$assert
->fieldValueEquals('data[value][date]', '0000-01-01');
$assert
->fieldValueEquals('data[value][time]', '12:00:00');
}