You are here

public function CommerceAttributeHandlerSettingTest::testCommerceAttributeTargetType in Commerce Migrate 3.1.x

Same name and namespace in other branches
  1. 8.2 modules/commerce/tests/src/Unit/Plugin/migrate/process/commerce1/CommerceAttributeHandlerSettingTest.php \Drupal\Tests\commerce_migrate_commerce\Unit\Plugin\migrate\process\commerce1\CommerceAttributeHandlerSettingTest::testCommerceAttributeTargetType()
  2. 3.0.x modules/commerce/tests/src/Unit/Plugin/migrate/process/commerce1/CommerceAttributeHandlerSettingTest.php \Drupal\Tests\commerce_migrate_commerce\Unit\Plugin\migrate\process\commerce1\CommerceAttributeHandlerSettingTest::testCommerceAttributeTargetType()

Tests with valid values.

@dataProvider providerTestCommerceAttributeTargetType

File

modules/commerce/tests/src/Unit/Plugin/migrate/process/commerce1/CommerceAttributeHandlerSettingTest.php, line 31

Class

CommerceAttributeHandlerSettingTest
Tests the CommerceAttributeTargetType plugin.

Namespace

Drupal\Tests\commerce_migrate_commerce\Unit\Plugin\migrate\process\commerce1

Code

public function testCommerceAttributeTargetType($src = NULL, $dst = NULL, $expected = NULL) {
  $this->row
    ->expects($this
    ->once())
    ->method('getDestinationProperty')
    ->willReturn($dst);
  $this->row
    ->method('getSourceProperty')
    ->will($this
    ->onConsecutiveCalls($src[0], $src[1], $src[2], $src[3]));
  $configuration = [];
  $this->plugin = new CommerceAttributeHandlerSetting($configuration, 'map', []);
  $value = $this->plugin
    ->transform('', $this->migrateExecutable, $this->row, 'destination_property');
  $this
    ->assertSame($expected, $value);
}