You are here

public function FormatDateTest::testMigrateExceptionMissingToFormat in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate/tests/src/Unit/process/FormatDateTest.php \Drupal\Tests\migrate\Unit\process\FormatDateTest::testMigrateExceptionMissingToFormat()

Tests that missing configuration will throw an exception.

File

core/modules/migrate/tests/src/Unit/process/FormatDateTest.php, line 35

Class

FormatDateTest
Tests the format date process plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testMigrateExceptionMissingToFormat() {
  $configuration = [
    'from_format' => 'm/d/Y',
    'to_format' => '',
  ];
  $this
    ->expectException(MigrateException::class);
  $this
    ->expectExceptionMessage('Format date plugin is missing to_format configuration.');
  $this->plugin = new FormatDate($configuration, 'test_format_date', []);
  $this->plugin
    ->transform('01/05/1955', $this->migrateExecutable, $this->row, 'field_date');
}