public function AttributeDestinationTest::testAttributeDestination in Commerce Migrate 3.0.x
Same name and namespace in other branches
- 8.2 modules/csv_example/tests/src/Unit/Plugin/migrate/process/AttributeDestinationTest.php \Drupal\Tests\commerce_migrate_csv_example\Unit\Plugin\migrate\process\AttributeDestinationTest::testAttributeDestination()
- 3.1.x modules/csv_example/tests/src/Unit/Plugin/migrate/process/AttributeDestinationTest.php \Drupal\Tests\commerce_migrate_csv_example\Unit\Plugin\migrate\process\AttributeDestinationTest::testAttributeDestination()
Tests Attribute Destination plugin.
@dataProvider providerTestAttributeDestination
File
- modules/
csv_example/ tests/ src/ Unit/ Plugin/ migrate/ process/ AttributeDestinationTest.php, line 23
Class
- AttributeDestinationTest
- Tests the Attribute Destination process plugin.
Namespace
Drupal\Tests\commerce_migrate_csv_example\Unit\Plugin\migrate\processCode
public function testAttributeDestination($value = NULL, $expected = NULL) {
$configuration = [];
$this->row = $this
->getMockBuilder('Drupal\\migrate\\Row')
->setMethods([
'get',
])
->disableOriginalConstructor()
->getMock();
$this->row
->expects($this
->once())
->method('get')
->with("attribute_{$value[0]}")
->willReturn($value[1]);
$this->plugin = new AttributeDestination($configuration, 'map', []);
$this->plugin
->transform($value, $this->migrateExecutable, $this->row, 'foo');
$property = $this->row
->get($expected[0]);
$this
->assertSame($expected[1], $property);
}