function FieldTypeDefaultsTest::testDefaults
Tests various default cases.
@legacy-covers ::transform
File
-
core/
modules/ field/ tests/ src/ Unit/ Plugin/ migrate/ process/ d6/ FieldTypeDefaultsTest.php, line 33
Class
- FieldTypeDefaultsTest
- Tests D6 fields defaults.
Namespace
Drupal\Tests\field\Unit\Plugin\migrate\process\d6Code
public function testDefaults() : void {
$this->row
->expects($this->once())
->method('getSourceProperty')
->willReturn('date');
// Assert common values are passed through without modification.
$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'));
// Assert that an array checks that this is a date field(above mock assert)
// and returns "datetime_default".
$this->assertEquals('datetime_default', $this->plugin
->transform([], $this->migrateExecutable, $this->row, 'property'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.