public function CommerceFieldNameTest::testCommerceFieldName in Commerce Migrate 3.0.x
Same name and namespace in other branches
- 8.2 modules/commerce/tests/src/Unit/Plugin/migrate/process/commerce1/CommerceFieldNameTest.php \Drupal\Tests\commerce_migrate_commerce\Unit\Plugin\migrate\process\commerce1\CommerceFieldNameTest::testCommerceFieldName()
- 3.1.x modules/commerce/tests/src/Unit/Plugin/migrate/process/commerce1/CommerceFieldNameTest.php \Drupal\Tests\commerce_migrate_commerce\Unit\Plugin\migrate\process\commerce1\CommerceFieldNameTest::testCommerceFieldName()
Tests CommerceFieldName plugin for an attribute.
@dataProvider providerCommerceFieldName
File
- modules/
commerce/ tests/ src/ Unit/ Plugin/ migrate/ process/ commerce1/ CommerceFieldNameTest.php, line 56
Class
- CommerceFieldNameTest
- Tests the CommerceFieldName plugin.
Namespace
Drupal\Tests\commerce_migrate_commerce\Unit\Plugin\migrate\process\commerce1Code
public function testCommerceFieldName($destination_property = NULL, $source_properties = NULL, $expected = NULL) {
$this->makeEntityUnique
->expects($this
->once())
->method('transform')
->willReturn('color');
$this->processPluginManager
->method('createInstance')
->willReturn($this->makeEntityUnique);
$this->row
->expects($this
->any())
->method('getDestinationProperty')
->willReturn($destination_property);
$this->row
->method('getSourceProperty')
->will($this
->onConsecutiveCalls($source_properties[0], $source_properties[1], $source_properties[2], $source_properties[3]));
$value = $this->plugin
->transform('', $this->migrateExecutable, $this->row, 'destination_property');
$this
->assertSame($expected, $value);
}