You are here

public function CommerceAttributeTargetTypeTest::testException in Commerce Migrate 3.0.x

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

Tests CommerceAttributeTargetType throws an exception.

@dataProvider providerTestException

File

modules/commerce/tests/src/Unit/Plugin/migrate/process/commerce1/CommerceAttributeTargetTypeTest.php, line 88

Class

CommerceAttributeTargetTypeTest
Tests the CommerceAttributeTargetType plugin.

Namespace

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

Code

public function testException($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]));
  $this
    ->expectException(MigrateSkipRowException::class);
  $this
    ->expectExceptionMessage($expected);
  $this->plugin
    ->transform('', $this->migrateExecutable, $this->row, $dst);
}