function FormatDateTest::testMigrateExceptionMissingFromFormat

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Unit/process/FormatDateTest.php \Drupal\Tests\migrate\Unit\process\FormatDateTest::testMigrateExceptionMissingFromFormat()
  2. 10 core/modules/migrate/tests/src/Unit/process/FormatDateTest.php \Drupal\Tests\migrate\Unit\process\FormatDateTest::testMigrateExceptionMissingFromFormat()
  3. 11.x core/modules/migrate/tests/src/Unit/process/FormatDateTest.php \Drupal\Tests\migrate\Unit\process\FormatDateTest::testMigrateExceptionMissingFromFormat()

Tests that missing configuration will throw an exception.

File

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

Class

FormatDateTest
Tests the format date process plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.