SkipRowIfNotSetTest.php in Drupal 8
File
core/modules/migrate/tests/src/Unit/process/SkipRowIfNotSetTest.php
View source
<?php
namespace Drupal\Tests\migrate\Unit\process;
use Drupal\migrate\MigrateSkipRowException;
use Drupal\migrate\Plugin\migrate\process\SkipRowIfNotSet;
class SkipRowIfNotSetTest extends MigrateProcessTestCase {
public function testRowSkipWithoutMessage() {
$configuration = [
'index' => 'some_key',
];
$process = new SkipRowIfNotSet($configuration, 'skip_row_if_not_set', []);
$this
->expectException(MigrateSkipRowException::class);
$process
->transform('', $this->migrateExecutable, $this->row, 'destination_property');
}
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');
}
}