
| Current Path : /var/www/html/store/web/core/modules/migrate/tests/src/Unit/process/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/store/web/core/modules/migrate/tests/src/Unit/process/SkipRowIfNotSetTest.php |
<?php
namespace Drupal\Tests\migrate\Unit\process;
use Drupal\migrate\MigrateSkipRowException;
use Drupal\migrate\Plugin\migrate\process\SkipRowIfNotSet;
/**
* Tests the skip row if not set process plugin.
*
* @group migrate
* @coversDefaultClass \Drupal\migrate\Plugin\migrate\process\SkipRowIfNotSet
*/
class SkipRowIfNotSetTest extends MigrateProcessTestCase {
/**
* Tests that a skip row exception without a message is raised.
*
* @covers ::transform
*/
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');
}
/**
* Tests that a skip row exception with a message is raised.
*
* @covers ::transform
*/
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');
}
}