DateFieldTest.php in Drupal 8
File
core/modules/datetime/tests/src/Unit/Plugin/migrate/field/d6/DateFieldTest.php
View source
<?php
namespace Drupal\Tests\datetime\Unit\Plugin\migrate\field\d6;
use Drupal\datetime\Plugin\migrate\field\d6\DateField;
use Drupal\migrate\MigrateException;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\Tests\UnitTestCase;
class DateFieldTest extends UnitTestCase {
protected $migration;
protected function setUp() {
parent::setUp();
$this->migration = $this
->prophesize(MigrationInterface::class)
->reveal();
}
public function testUnknownDateType($method = 'defineValueProcessPipeline') {
$plugin = new DateField([], '', []);
$this
->expectException(MigrateException::class);
$this
->expectExceptionMessage("Field field_date of type 'timestamp' is an unknown date field type.");
$plugin
->{$method}($this->migration, 'field_date', [
'type' => 'timestamp',
]);
}
}