DateConfigurableListWidgetTest.php in Datetime Extras 8
File
tests/src/Kernel/DateConfigurableListWidgetTest.php
View source
<?php
namespace Drupal\Tests\datetime_extras\Kernel;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\KernelTests\KernelTestBase;
use Drupal\Tests\Traits\ExpectDeprecationTrait;
class DateConfigurableListWidgetTest extends KernelTestBase {
use ExpectDeprecationTrait;
protected static $modules = [
'datetime',
'datetime_extras',
];
public function testConstruction() {
$base_field_definition = BaseFieldDefinition::create('datetime')
->setName('Configurable List');
$widget_options = [
'field_definition' => $base_field_definition,
'form_mode' => 'default',
'configuration' => [
'type' => 'datatime_extras_configurable_list',
],
];
$expected_message = 'The Drupal\\datetime_extras\\Plugin\\Field\\FieldWidget\\DateConfigurableListWidget is deprecated in datetime_extras:8.x-1.0 and is removed from datetime_extras:8.x-2.0. Use Drupal\\datetime_extras\\Plugin\\Field\\FieldWidget\\DateTimeDatelistNoTimeWidget instead. See https://www.drupal.org/node/2973035';
if (method_exists($this, 'addExpectedDeprecationMessage')) {
$this
->addExpectedDeprecationMessage($expected_message);
}
else {
$this
->expectDeprecation($expected_message);
}
$this->container
->get('plugin.manager.field.widget')
->getInstance($widget_options);
}
}