You are here

public function SkipRowIfNotSetTest::testRowSkipWithMessage in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate/tests/src/Unit/process/SkipRowIfNotSetTest.php \Drupal\Tests\migrate\Unit\process\SkipRowIfNotSetTest::testRowSkipWithMessage()

Tests that a skip row exception with a message is raised.

@covers ::transform

File

core/modules/migrate/tests/src/Unit/process/SkipRowIfNotSetTest.php, line 35

Class

SkipRowIfNotSetTest
Tests the skip row if not set process plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function testRowSkipWithMessage() {
  $configuration = [
    'index' => 'some_key',
    'message' => "The 'some_key' key is not set",
  ];
  $process = new SkipRowIfNotSet($configuration, 'skip_row_if_not_set', []);
  $this
    ->expectException(MigrateSkipRowException::class);
  $this
    ->expectExceptionMessage("The 'some_key' key is not set");
  $process
    ->transform('', $this->migrateExecutable, $this->row, 'destination_property');
}