3 namespace Drupal\Tests\datetime\Unit\Plugin\migrate\field\d6;
5 use Drupal\datetime\Plugin\migrate\field\d6\DateField;
6 use Drupal\migrate\MigrateException;
7 use Drupal\migrate\Plugin\MigrationInterface;
8 use Drupal\Tests\UnitTestCase;
14 class DateFieldTest extends UnitTestCase {
17 * @var \Drupal\migrate\Plugin\MigrationInterface
24 protected function setUp() {
26 $this->migration = $this->prophesize(MigrationInterface::class)->reveal();
30 * Tests an Exception is thrown when the field type is not a known date type.
32 * @runInSeparateProcess
33 * @expectedDeprecation DateField is deprecated in Drupal 8.4.x and will be removed before Drupal 9.0.x. Use \Drupal\datetime\Plugin\migrate\field\DateField instead.
35 public function testUnknownDateType($method = 'defineValueProcessPipeline') {
36 $plugin = new DateField([], '', []);
38 $this->setExpectedException(MigrateException::class, "Field field_date of type 'timestamp' is an unknown date field type.");
39 $plugin->$method($this->migration, 'field_date', ['type' => 'timestamp']);