3 namespace Drupal\Tests\field\Unit\Plugin\migrate\process\d7;
5 use Drupal\field\Plugin\migrate\process\d7\FieldTypeDefaults;
6 use Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase;
9 * Tests D7 field formatter defaults.
11 * @coversDefaultClass \Drupal\field\Plugin\migrate\process\d7\FieldTypeDefaults
14 class FieldTypeDefaultsTest extends MigrateProcessTestCase {
19 protected function setUp() {
21 $this->plugin = new FieldTypeDefaults([], 'd7_field_type_defaults', []);
25 * Tests various default cases.
29 public function testDefaults() {
30 // Assert common values are passed through without modification.
31 $this->assertNull($this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'property'));
32 $this->assertEquals('string', $this->plugin->transform('string', $this->migrateExecutable, $this->row, 'property'));
33 $this->assertEquals(1234, $this->plugin->transform(1234, $this->migrateExecutable, $this->row, 'property'));
34 // Assert that an array will return the second item, which is the source
36 $this->assertEquals('datetime_default', $this->plugin->transform(['datetime', 'datetime_default'], $this->migrateExecutable, $this->row, 'property'));