You are here

public function DateFieldTest::testUnknownDateType in Drupal 8

Tests an Exception is thrown when the field type is not a known date type.

@runInSeparateProcess @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.

1 call to DateFieldTest::testUnknownDateType()
DateFieldLegacyTest::testUnknownDateType in core/modules/datetime/tests/src/Unit/Plugin/migrate/field/d6/DateFieldLegacyTest.php
@expectedDeprecation Deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use defineValueProcessPipeline() instead. See https://www.drupal.org/node/2944598.
1 method overrides DateFieldTest::testUnknownDateType()
DateFieldLegacyTest::testUnknownDateType in core/modules/datetime/tests/src/Unit/Plugin/migrate/field/d6/DateFieldLegacyTest.php
@expectedDeprecation Deprecated in Drupal 8.6.0, to be removed before Drupal 9.0.0. Use defineValueProcessPipeline() instead. See https://www.drupal.org/node/2944598.

File

core/modules/datetime/tests/src/Unit/Plugin/migrate/field/d6/DateFieldTest.php, line 35

Class

DateFieldTest
@group migrate @group legacy

Namespace

Drupal\Tests\datetime\Unit\Plugin\migrate\field\d6

Code

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',
  ]);
}