public function FormatDateTest::testMigrateExceptionUnexpectedValue in Drupal 10
Same name and namespace in other branches
- 8 core/modules/migrate/tests/src/Unit/process/FormatDateTest.php \Drupal\Tests\migrate\Unit\process\FormatDateTest::testMigrateExceptionUnexpectedValue()
- 9 core/modules/migrate/tests/src/Unit/process/FormatDateTest.php \Drupal\Tests\migrate\Unit\process\FormatDateTest::testMigrateExceptionUnexpectedValue()
Tests that an unexpected date value will throw an exception.
File
- core/
modules/ migrate/ tests/ src/ Unit/ process/ FormatDateTest.php, line 65
Class
- FormatDateTest
- Tests the format date process plugin.
Namespace
Drupal\Tests\migrate\Unit\processCode
public function testMigrateExceptionUnexpectedValue() {
$configuration = [
'from_format' => 'm/d/Y',
'to_format' => 'Y-m-d',
];
$this
->expectException(MigrateException::class);
$this
->expectExceptionMessage("Format date plugin could not transform '01/05/55' using the format 'm/d/Y'. Error: The created date does not match the input value.");
$this->plugin = new FormatDate($configuration, 'test_format_date', []);
$this->plugin
->transform('01/05/55', $this->migrateExecutable, $this->row, 'field_date');
}