function FormatDateTest::testMigrateExceptionBadFormat
Same name in other branches
- 9 core/modules/migrate/tests/src/Unit/process/FormatDateTest.php \Drupal\Tests\migrate\Unit\process\FormatDateTest::testMigrateExceptionBadFormat()
- 8.9.x core/modules/migrate/tests/src/Unit/process/FormatDateTest.php \Drupal\Tests\migrate\Unit\process\FormatDateTest::testMigrateExceptionBadFormat()
- 11.x core/modules/migrate/tests/src/Unit/process/FormatDateTest.php \Drupal\Tests\migrate\Unit\process\FormatDateTest::testMigrateExceptionBadFormat()
Tests that date format mismatches will throw an exception.
File
-
core/
modules/ migrate/ tests/ src/ Unit/ process/ FormatDateTest.php, line 52
Class
- FormatDateTest
- Tests the format date process plugin.
Namespace
Drupal\Tests\migrate\Unit\processCode
public function testMigrateExceptionBadFormat() : void {
$configuration = [
'from_format' => 'm/d/Y',
'to_format' => 'Y-m-d',
];
$this->expectException(MigrateException::class);
$this->expectExceptionMessage("Format date plugin could not transform 'January 5, 1955' using the format 'm/d/Y'. Error: The date cannot be created from a format.");
$this->plugin = new FormatDate($configuration, 'test_format_date', []);
$this->plugin
->transform('January 5, 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.