FieldTypeDefaultsTest.php
Same filename in this branch
Same filename in other branches
- 9 core/modules/field/tests/src/Unit/Plugin/migrate/process/d6/FieldTypeDefaultsTest.php
- 9 core/modules/field/tests/src/Unit/Plugin/migrate/process/d7/FieldTypeDefaultsTest.php
- 8.9.x core/modules/field/tests/src/Unit/Plugin/migrate/process/FieldTypeDefaultsTest.php
- 8.9.x core/modules/field/tests/src/Unit/Plugin/migrate/process/d6/FieldTypeDefaultsTest.php
- 8.9.x core/modules/field/tests/src/Unit/Plugin/migrate/process/d7/FieldTypeDefaultsTest.php
- 11.x core/modules/field/tests/src/Unit/Plugin/migrate/process/d6/FieldTypeDefaultsTest.php
- 11.x core/modules/field/tests/src/Unit/Plugin/migrate/process/d7/FieldTypeDefaultsTest.php
Namespace
Drupal\Tests\field\Unit\Plugin\migrate\process\d7File
-
core/
modules/ field/ tests/ src/ Unit/ Plugin/ migrate/ process/ d7/ FieldTypeDefaultsTest.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\field\Unit\Plugin\migrate\process\d7;
use Drupal\field\Plugin\migrate\process\d7\FieldTypeDefaults;
use Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase;
/**
* Tests D7 field formatter defaults.
*
* @coversDefaultClass \Drupal\field\Plugin\migrate\process\d7\FieldTypeDefaults
* @group field
*/
class FieldTypeDefaultsTest extends MigrateProcessTestCase {
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->plugin = new FieldTypeDefaults([], 'd7_field_type_defaults', []);
}
/**
* Tests various default cases.
*
* @covers ::transform
*/
public function testDefaults() : void {
// 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 will return the second item, which is the source
// formatter type.
$this->assertEquals('datetime_default', $this->plugin
->transform([
'datetime',
'datetime_default',
], $this->migrateExecutable, $this->row, 'property'));
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
FieldTypeDefaultsTest | Tests D7 field formatter defaults. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.