You are here

public function DateTimeDatelistNoTimeWidgetTest::testConstruction in Datetime Extras 8

@covers ::__construct

File

tests/src/Kernel/DateTimeDatelistNoTimeWidgetTest.php, line 28

Class

DateTimeDatelistNoTimeWidgetTest
Test the DateTimeConfigurableList for datetime fields.

Namespace

Drupal\Tests\datetime_extras\Kernel

Code

public function testConstruction() {
  $base_field_definition = BaseFieldDefinition::create('datetime')
    ->setName('Configurable List');
  $widget_options = [
    'field_definition' => $base_field_definition,
    'form_mode' => 'default',
    'configuration' => [
      'type' => 'datetime_datelist_no_time',
    ],
  ];
  $instance = $this->container
    ->get('plugin.manager.field.widget')
    ->getInstance($widget_options);
  $this
    ->assertInstanceOf(DateTimeDatelistNoTimeWidget::class, $instance);
}