diff --git a/core/modules/field/src/Plugin/migrate/process/d6/FieldTypeDefaults.php b/core/modules/field/src/Plugin/migrate/process/d6/FieldTypeDefaults.php index 542826a..eb2a97f 100644 --- a/core/modules/field/src/Plugin/migrate/process/d6/FieldTypeDefaults.php +++ b/core/modules/field/src/Plugin/migrate/process/d6/FieldTypeDefaults.php @@ -7,7 +7,7 @@ namespace Drupal\field\Plugin\migrate\process\d6; -use Drupal\migrate\MigrateSkipRowException; +use Drupal\migrate\MigrateException; use Drupal\migrate\ProcessPluginBase; use Drupal\migrate\MigrateExecutableInterface; use Drupal\migrate\Row; @@ -30,7 +30,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable $value = 'datetime_default'; } else { - throw new MigrateSkipRowException(sprintf('Failed to lookup field type %s in the static map.', var_export($value, TRUE))); + throw new MigrateException(sprintf('Failed to lookup field type %s in the static map.', var_export($value, TRUE))); } } return $value; diff --git a/core/modules/field/tests/src/Unit/Plugin/migrate/process/d6/FieldTypeDefaultsTest.php b/core/modules/field/tests/src/Unit/Plugin/migrate/process/d6/FieldTypeDefaultsTest.php index 21e6337..dcdfdd8 100644 --- a/core/modules/field/tests/src/Unit/Plugin/migrate/process/d6/FieldTypeDefaultsTest.php +++ b/core/modules/field/tests/src/Unit/Plugin/migrate/process/d6/FieldTypeDefaultsTest.php @@ -8,6 +8,7 @@ namespace Drupal\Tests\field\Unit\Plugin\migrate\process\d6; use Drupal\field\Plugin\migrate\process\d6\FieldTypeDefaults; +use Drupal\migrate\MigrateException; use Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase; /** @@ -20,26 +21,28 @@ class FieldTypeDefaultsTest extends MigrateProcessTestCase { /** * Test that various default cases. + * * @covers ::transform */ public function testDefaults() { $plugin = new FieldTypeDefaults([], 'field_type_defaults', []); - $this->assertNull($plugin->transform(NULL, $this->migrateExecutable, $this->row, 'property')); - $this->assertEquals('string', $plugin->transform('string', $this->migrateExecutable, $this->row, 'property')); - $this->assertEquals(1234, $plugin->transform(1234, $this->migrateExecutable, $this->row, 'property')); - $this->row->expects($this->once()) ->method('getSourceProperty') ->willReturn('date'); + + $this->assertNull($plugin->transform(NULL, $this->migrateExecutable, $this->row, 'property')); + $this->assertEquals('string', $plugin->transform('string', $this->migrateExecutable, $this->row, 'property')); + $this->assertEquals(1234, $plugin->transform(1234, $this->migrateExecutable, $this->row, 'property')); $this->assertEquals('datetime_default', $plugin->transform([], $this->migrateExecutable, $this->row, 'property')); } /** - * @expectedException \Drupal\migrate\MigrateSkipRowException * @covers ::transform */ public function testDefaultsException() { $plugin = new FieldTypeDefaults([], 'field_type_defaults', []); + $this->setExpectedException(MigrateException::class, + sprintf('Failed to lookup field type %s in the static map.', var_export([], TRUE))); $plugin->transform([], $this->migrateExecutable, $this->row, 'property'); } }