Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / migrate / tests / src / Unit / process / SkipRowIfNotSetTest.php
1 <?php
2
3 namespace Drupal\Tests\migrate\Unit\process;
4
5 use Drupal\migrate\MigrateSkipRowException;
6 use Drupal\migrate\Plugin\migrate\process\SkipRowIfNotSet;
7
8 /**
9  * Tests the skip row if not set process plugin.
10  *
11  * @group migrate
12  * @coversDefaultClass \Drupal\migrate\Plugin\migrate\process\SkipRowIfNotSet
13  */
14 class SkipRowIfNotSetTest extends MigrateProcessTestCase {
15
16   /**
17    * Tests that a skip row exception without a message is raised.
18    *
19    * @covers ::transform
20    */
21   public function testRowSkipWithoutMessage() {
22     $configuration = [
23       'index' => 'some_key',
24     ];
25     $process = new SkipRowIfNotSet($configuration, 'skip_row_if_not_set', []);
26     $this->setExpectedException(MigrateSkipRowException::class);
27     $process->transform('', $this->migrateExecutable, $this->row, 'destinationproperty');
28   }
29
30   /**
31    * Tests that a skip row exception with a message is raised.
32    *
33    * @covers ::transform
34    */
35   public function testRowSkipWithMessage() {
36     $configuration = [
37       'index' => 'some_key',
38       'message' => "The 'some_key' key is not set",
39     ];
40     $process = new SkipRowIfNotSet($configuration, 'skip_row_if_not_set', []);
41     $this->setExpectedException(MigrateSkipRowException::class, "The 'some_key' key is not set");
42     $process->transform('', $this->migrateExecutable, $this->row, 'destinationproperty');
43   }
44
45 }