diff -u b/core/modules/datetime/src/Plugin/migrate/field/d6/DateField.php b/core/modules/datetime/src/Plugin/migrate/field/d6/DateField.php --- b/core/modules/datetime/src/Plugin/migrate/field/d6/DateField.php +++ b/core/modules/datetime/src/Plugin/migrate/field/d6/DateField.php @@ -3,7 +3,7 @@ namespace Drupal\datetime\Plugin\migrate\field\d6; use Drupal\migrate\Plugin\MigrationInterface; -use Drupal\migrate\Row; +use Drupal\migrate\MigrateException; use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase; /** @@ -43,7 +43,6 @@ * {@inheritdoc} */ public function processFieldValues(MigrationInterface $migration, $field_name, $data) { - switch($data['type']) { case 'date': $from_format = 'Y-m-d\TH:i:s'; @@ -58,8 +57,7 @@ $to_format = 'Y-m-d\TH:i:s'; break; default: - // Set an invalid format which forces a MigrateException in format_date. - $from_format = ''; + throw new MigrateException(sprintf('Field %s is an unknown date field type.', var_export($data['type'], TRUE))); } $process = [ 'value' => [ only in patch2: unchanged: --- /dev/null +++ b/core/modules/datetime/tests/src/Unit/process/DateFieldTest.php @@ -0,0 +1,35 @@ +migration = $this->prophesize('Drupal\migrate\Plugin\MigrationInterface')->reveal(); + $this->plugin = new DateField([], '', []); + + $this->setExpectedException(MigrateException::class, "Field 'timestamp' is an unknown date field type."); + $this->plugin->processFieldValues($this->migration, '', ['type' => 'timestamp']); + } + +}