FieldTypeDefaultsTest.php in Drupal 8
File
core/modules/field/tests/src/Unit/Plugin/migrate/process/d7/FieldTypeDefaultsTest.php
View source
<?php
namespace Drupal\Tests\field\Unit\Plugin\migrate\process\d7;
use Drupal\field\Plugin\migrate\process\d7\FieldTypeDefaults;
use Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase;
class FieldTypeDefaultsTest extends MigrateProcessTestCase {
protected function setUp() {
parent::setUp();
$this->plugin = new FieldTypeDefaults([], 'd7_field_type_defaults', []);
}
public function testDefaults() {
$this
->assertNull($this->plugin
->transform(NULL, $this->migrateExecutable, $this->row, 'property'));
$this
->assertEquals('string', $this->plugin
->transform('string', $this->migrateExecutable, $this->row, 'property'));
$this
->assertEquals(1234, $this->plugin
->transform(1234, $this->migrateExecutable, $this->row, 'property'));
$this
->assertEquals('datetime_default', $this->plugin
->transform([
'datetime',
'datetime_default',
], $this->migrateExecutable, $this->row, 'property'));
}
}