diff --git a/core/modules/migrate/src/Plugin/migrate/process/SkipOnEmpty.php b/core/modules/migrate/src/Plugin/migrate/process/SkipOnEmpty.php index 2768dbb205..c7d3ad5ea1 100644 --- a/core/modules/migrate/src/Plugin/migrate/process/SkipOnEmpty.php +++ b/core/modules/migrate/src/Plugin/migrate/process/SkipOnEmpty.php @@ -36,8 +36,8 @@ * message: 'Field field_name is missed' * @endcode * - * If field_name is empty, skips the entire row and logs 'Field field_name is - * missed' in the message table. + * If field_name is empty, skips the entire row and the message 'Field + * field_name is missed' is logged in the message table. * * @code * process: diff --git a/core/modules/migrate/src/Plugin/migrate/process/SkipRowIfNotSet.php b/core/modules/migrate/src/Plugin/migrate/process/SkipRowIfNotSet.php index 85446eb7e9..fa9b3f6180 100644 --- a/core/modules/migrate/src/Plugin/migrate/process/SkipRowIfNotSet.php +++ b/core/modules/migrate/src/Plugin/migrate/process/SkipRowIfNotSet.php @@ -17,7 +17,7 @@ * Available configuration keys: * - index: The source property to check for. * - message: (optional) A message to be logged in the {migrate_message_*} table - * for this row. If is missed, nothing is logged in the message table. + * for this row. If not set, nothing is logged in the message table. * * Example: * @@ -32,7 +32,8 @@ * @endcode * * This will return $data['contact'] if it exists. Otherwise, the row will be - * skipped and the message "Missed the 'data' key" will be logged. + * skipped and the message "Missed the 'data' key" will be logged in the + * message table. * * @see \Drupal\migrate\Plugin\MigrateProcessInterface * diff --git a/core/modules/migrate/tests/src/Unit/process/SkipOnEmptyTest.php b/core/modules/migrate/tests/src/Unit/process/SkipOnEmptyTest.php index ce71c5a1cd..00cbf37399 100644 --- a/core/modules/migrate/tests/src/Unit/process/SkipOnEmptyTest.php +++ b/core/modules/migrate/tests/src/Unit/process/SkipOnEmptyTest.php @@ -2,6 +2,7 @@ namespace Drupal\Tests\migrate\Unit\process; +use Drupal\migrate\MigrateSkipRowException; use Drupal\migrate\Plugin\migrate\process\SkipOnEmpty; /** @@ -14,12 +15,12 @@ class SkipOnEmptyTest extends MigrateProcessTestCase { /** * @covers ::process + * @expectedException \Drupal\migrate\MigrateSkipProcessException */ public function testProcessSkipsOnEmpty() { $configuration['method'] = 'process'; (new SkipOnEmpty($configuration, 'skip_on_empty', [])) ->transform('', $this->migrateExecutable, $this->row, 'destinationproperty'); - $this->setExpectedException(\Drupal\migrate\MigrateSkipProcessException); } /** @@ -34,12 +35,12 @@ public function testProcessBypassesOnNonEmpty() { /** * @covers ::row + * @expectedException \Drupal\migrate\MigrateSkipRowException */ public function testRowSkipsOnEmpty() { $configuration['method'] = 'row'; (new SkipOnEmpty($configuration, 'skip_on_empty', [])) ->transform('', $this->migrateExecutable, $this->row, 'destinationproperty'); - $this->setExpectedException(\Drupal\migrate\MigrateSkipRowException); } /** @@ -56,14 +57,13 @@ public function testRowBypassesOnNonEmpty() { * Tests that a skip row exception without a message is raised. * * @covers ::row - * @expectedException \Drupal\migrate\MigrateSkipRowException - * @expectedExceptionMessage */ public function testRowSkipWithoutMessage() { $configuration = [ 'method' => 'row', ]; $process = new SkipOnEmpty($configuration, 'skip_on_empty', []); + $this->setExpectedException(MigrateSkipRowException::class); $process->transform('', $this->migrateExecutable, $this->row, 'destinationproperty'); } @@ -71,8 +71,6 @@ public function testRowSkipWithoutMessage() { * Tests that a skip row exception with a message is raised. * * @covers ::row - * @expectedException \Drupal\migrate\MigrateSkipRowException - * @expectedExceptionMessage The value is empty */ public function testRowSkipWithMessage() { $configuration = [ @@ -80,6 +78,7 @@ public function testRowSkipWithMessage() { 'message' => 'The value is empty', ]; $process = new SkipOnEmpty($configuration, 'skip_on_empty', []); + $this->setExpectedException(MigrateSkipRowException::class, 'The value is empty'); $process->transform('', $this->migrateExecutable, $this->row, 'destinationproperty'); } diff --git a/core/modules/migrate/tests/src/Unit/process/SkipRowIfNotSetTest.php b/core/modules/migrate/tests/src/Unit/process/SkipRowIfNotSetTest.php index abec296355..26e5b3fb4a 100644 --- a/core/modules/migrate/tests/src/Unit/process/SkipRowIfNotSetTest.php +++ b/core/modules/migrate/tests/src/Unit/process/SkipRowIfNotSetTest.php @@ -2,6 +2,7 @@ namespace Drupal\Tests\migrate\Unit\process; +use Drupal\migrate\MigrateSkipRowException; use Drupal\migrate\Plugin\migrate\process\SkipRowIfNotSet; /** @@ -16,22 +17,20 @@ class SkipRowIfNotSetTest extends MigrateProcessTestCase { * Tests that a skip row exception without a message is raised. * * @covers ::transform - * @expectedExceptionMessage */ public function testRowSkipWithoutMessage() { $configuration = [ 'index' => 'some_key', ]; $process = new SkipRowIfNotSet($configuration, 'skip_row_if_not_set', []); + $this->setExpectedException(MigrateSkipRowException::class); $process->transform('', $this->migrateExecutable, $this->row, 'destinationproperty'); - $this->setExpectedException(\Drupal\migrate\MigrateSkipRowException); } /** * Tests that a skip row exception with a message is raised. * * @covers ::transform - * @expectedExceptionMessage The 'some_key' key is not set */ public function testRowSkipWithMessage() { $configuration = [ @@ -39,8 +38,8 @@ public function testRowSkipWithMessage() { 'message' => "The 'some_key' key is not set", ]; $process = new SkipRowIfNotSet($configuration, 'skip_row_if_not_set', []); + $this->setExpectedException(MigrateSkipRowException::class, "The 'some_key' key is not set"); $process->transform('', $this->migrateExecutable, $this->row, 'destinationproperty'); - $this->setExpectedException(\Drupal\migrate\MigrateSkipRowException); } }