diff --git a/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/process/DedupeBase.php b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/process/DedupeBase.php index 47fcee1..2900f1d 100644 --- a/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/process/DedupeBase.php +++ b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/process/DedupeBase.php @@ -35,11 +35,11 @@ public function transform($value, MigrateExecutable $migrate_executable, Row $ro } $start = isset($this->configuration['start']) ? $this->configuration['start'] : 0; if (!is_int($start)) { - throw new MigrateException('Input start position should be an integer.'); + throw new MigrateException('The start position configuration key should be an integer. Omit this key to capture from the beginning of the string.'); } $length = isset($this->configuration['length']) ? $this->configuration['length'] : NULL; if (!is_null($length) && !is_int($length)) { - throw new MigrateException('Input character length should be an integer.'); + throw new MigrateException('The character length configuration key should be an integer. Omit this key to capture the entire string.'); } // Use optional start or length to return a portion of deduplicated value. $new_value = Unicode::substr($new_value, $start, $length); diff --git a/core/modules/migrate/tests/Drupal/migrate/Tests/process/DedupeEntityTest.php b/core/modules/migrate/tests/Drupal/migrate/Tests/process/DedupeEntityTest.php index 7d1bef0..9c987c3 100644 --- a/core/modules/migrate/tests/Drupal/migrate/Tests/process/DedupeEntityTest.php +++ b/core/modules/migrate/tests/Drupal/migrate/Tests/process/DedupeEntityTest.php @@ -101,25 +101,32 @@ public function testDedupe($count, $postfix = '', $start = NULL, $length = NULL) } /** - * Tests that invalid substring start and length options throw exceptions. + * Tests that invalid start position throws an exception. */ - public function testDedupeEntityInvalidOptions() { + public function testDedupeEntityInvalidStart() { $configuration = array( 'entity_type' => 'test_entity_type', 'field' => 'test_field', 'start' => 'foobar', ); - // Test an invalid substring start position. $plugin = new DedupeEntity($configuration, 'dedupe_entity', array(), $this->getMigration(), $this->entityQueryFactory); $this->entityQueryExpects(0); - $this->setExpectedException('Drupal\migrate\MigrateException', 'Input start position should be an integer.'); + $this->setExpectedException('Drupal\migrate\MigrateException', 'The start position configuration key should be an integer. Omit this key to capture from the beginning of the string.'); $plugin->transform('test_start', $this->migrateExecutable, $this->row, 'testproperty'); + } - // Test an invalid substring character length. - $configuration['length'] = 'foobar'; + /** + * Tests that invalid length option throws an exception. + */ + public function testDedupeEntityInvalidLength() { + $configuration = array( + 'entity_type' => 'test_entity_type', + 'field' => 'test_field', + 'length' => 'foobar', + ); $plugin = new DedupeEntity($configuration, 'dedupe_entity', array(), $this->getMigration(), $this->entityQueryFactory); $this->entityQueryExpects(0); - $this->setExpectedException('Drupal\migrate\MigrateException', 'Input character length should be an integer.'); + $this->setExpectedException('Drupal\migrate\MigrateException', 'The character length configuration key should be an integer. Omit this key to capture the entire string.'); $plugin->transform('test_length', $this->migrateExecutable, $this->row, 'testproperty'); }