update drupal
This commit is contained in:
@@ -189,7 +189,11 @@ class MigrateExecutable implements MigrateExecutableInterface {
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
$this->message->display(
|
||||
$this->t('Migration failed with source plugin exception: @e', ['@e' => $e->getMessage()]), 'error');
|
||||
$this->t('Migration failed with source plugin exception: @e in @file line @line', [
|
||||
'@e' => $e->getMessage(),
|
||||
'@file' => $e->getFile(),
|
||||
'@line' => $e->getLine(),
|
||||
]), 'error');
|
||||
$this->migration->setStatus(MigrationInterface::STATUS_IDLE);
|
||||
return MigrationInterface::RESULT_FAILED;
|
||||
}
|
||||
@@ -269,8 +273,11 @@ class MigrateExecutable implements MigrateExecutableInterface {
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
$this->message->display(
|
||||
$this->t('Migration failed with source plugin exception: @e',
|
||||
['@e' => $e->getMessage()]), 'error');
|
||||
$this->t('Migration failed with source plugin exception: @e in @file line @line', [
|
||||
'@e' => $e->getMessage(),
|
||||
'@file' => $e->getFile(),
|
||||
'@line' => $e->getLine(),
|
||||
]), 'error');
|
||||
$this->migration->setStatus(MigrationInterface::STATUS_IDLE);
|
||||
return MigrationInterface::RESULT_FAILED;
|
||||
}
|
||||
|
||||
@@ -13,21 +13,56 @@ use Drupal\migrate\Row;
|
||||
* for audit and rollback purposes. The keys used in the migrate_map table are
|
||||
* of the form sourceidN and destidN for the source and destination values
|
||||
* respectively.
|
||||
*
|
||||
* The mappings are stored in a migrate_map table with properties:
|
||||
* - source_ids_hash: A hash of the source IDs.
|
||||
* - sourceidN: Any number of source IDs defined by a source plugin, where N
|
||||
* starts at 1, for example, sourceid1, sourceid2 ... sourceidN.
|
||||
* - destidN: Any number of destination IDs defined by a destination plugin,
|
||||
* where N starts at 1, for example, destid1, destid2 ... destidN.
|
||||
* - source_row_status: Indicates current status of the source row, valid
|
||||
* values are self::STATUS_IMPORTED, self::STATUS_NEEDS_UPDATE,
|
||||
* self::STATUS_IGNORED or self::STATUS_FAILED.
|
||||
* - rollback_action: Flag indicating what to do for this item on rollback. This
|
||||
* property is set in destination plugins. Valid values are
|
||||
* self::ROLLBACK_DELETE and self::ROLLBACK_PRESERVE.
|
||||
* - last_imported: UNIX timestamp of the last time the row was imported.
|
||||
* - hash: A hash of the source row data that is used to detect changes in the
|
||||
* source data.
|
||||
*/
|
||||
interface MigrateIdMapInterface extends \Iterator, PluginInspectionInterface {
|
||||
|
||||
/**
|
||||
* Codes reflecting the current status of a map row.
|
||||
* Indicates that the import of the row was successful.
|
||||
*/
|
||||
const STATUS_IMPORTED = 0;
|
||||
|
||||
/**
|
||||
* Indicates that the row needs to be updated.
|
||||
*/
|
||||
const STATUS_NEEDS_UPDATE = 1;
|
||||
|
||||
/**
|
||||
* Indicates that the import of the row was ignored.
|
||||
*/
|
||||
const STATUS_IGNORED = 2;
|
||||
|
||||
/**
|
||||
* Indicates that the import of the row failed.
|
||||
*/
|
||||
const STATUS_FAILED = 3;
|
||||
|
||||
/**
|
||||
* Codes reflecting how to handle the destination item on rollback.
|
||||
* Indicates that the data for the row is to be deleted.
|
||||
*/
|
||||
const ROLLBACK_DELETE = 0;
|
||||
|
||||
/**
|
||||
* Indicates that the data for the row is to be preserved.
|
||||
*
|
||||
* Rows that refer to entities that already exist on the destination and are
|
||||
* being updated are preserved.
|
||||
*/
|
||||
const ROLLBACK_PRESERVE = 1;
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,16 +9,9 @@ use Drupal\migrate\Row;
|
||||
/**
|
||||
* An interface for migrate process plugins.
|
||||
*
|
||||
* A process plugin will typically implement the transform() method to perform
|
||||
* its work. However, it is possible instead for a process plugin to use any
|
||||
* number of methods, thus offering different alternatives ways of processing.
|
||||
* In this case, the transform() method should not be implemented, and the
|
||||
* plugin configuration must provide the name of the method to be called via the
|
||||
* "method" key. Each method must have the same signature as transform().
|
||||
* The base class \Drupal\migrate\ProcessPluginBase takes care of implementing
|
||||
* transform() and calling the configured method. See
|
||||
* \Drupal\migrate\Plugin\migrate\process\SkipOnEmpty and
|
||||
* d6_field_instance_widget_settings.yml for examples.
|
||||
* Migrate process plugins transform the input value.For example, transform a
|
||||
* human provided name into a machine name, look up an identifier in a previous
|
||||
* migration and so on.
|
||||
*
|
||||
* @see \Drupal\migrate\Plugin\MigratePluginManager
|
||||
* @see \Drupal\migrate\ProcessPluginBase
|
||||
|
||||
@@ -14,6 +14,10 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
/**
|
||||
* Provides a generic destination to import entities.
|
||||
*
|
||||
* Available configuration keys:
|
||||
* - default_bundle: (optional) The bundle to use for this row if 'bundle' is
|
||||
* not defined on the row.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* @code
|
||||
@@ -44,8 +48,11 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
* revision_timestamp: timestamp
|
||||
* destination:
|
||||
* plugin: entity:node
|
||||
* default_bundle: custom
|
||||
* @endcode
|
||||
*
|
||||
* This will save the processed, migrated row as a node of type 'custom'.
|
||||
*
|
||||
* @MigrateDestination(
|
||||
* id = "entity",
|
||||
* deriver = "Drupal\migrate\Plugin\Derivative\MigrateEntity"
|
||||
|
||||
@@ -85,6 +85,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
* validate: true
|
||||
* @endcode
|
||||
*
|
||||
* @see \Drupal\migrate\Plugin\migrate\destination\Entity
|
||||
* @see \Drupal\migrate\Plugin\migrate\destination\EntityRevision
|
||||
*/
|
||||
class EntityContentBase extends Entity implements HighestIdInterface, MigrateValidatableEntityInterface {
|
||||
|
||||
@@ -29,8 +29,8 @@ use Drupal\migrate\Row;
|
||||
* @endcode
|
||||
*
|
||||
* This will set new_text_field to the concatenation of the 'foo' and 'bar'
|
||||
* source values. For example, if the 'foo' property is "wambooli" and the 'bar'
|
||||
* property is "pastafazoul", new_text_field will be "wamboolipastafazoul".
|
||||
* source values. For example, if the 'foo' property is "Rosa" and the 'bar'
|
||||
* property is "Parks", new_text_field will be "RosaParks".
|
||||
*
|
||||
* You can also specify a delimiter.
|
||||
*
|
||||
@@ -46,8 +46,8 @@ use Drupal\migrate\Row;
|
||||
*
|
||||
* This will set new_text_field to the concatenation of the 'foo' source value,
|
||||
* the delimiter and the 'bar' source value. For example, using the values above
|
||||
* and "/" as the delimiter, if the 'foo' property is "wambooli" and the 'bar'
|
||||
* property is "pastafazoul", new_text_field will be "wambooli/pastafazoul".
|
||||
* and "/" as the delimiter, if the 'foo' property is "Rosa" and the 'bar'
|
||||
* property is "Rosa", new_text_field will be "Rosa/Parks".
|
||||
*
|
||||
* @see \Drupal\migrate\Plugin\MigrateProcessInterface
|
||||
*
|
||||
|
||||
@@ -16,7 +16,8 @@ use Drupal\migrate\Row;
|
||||
* Available configuration keys:
|
||||
* - process: the plugin(s) that will process each element of the source.
|
||||
* - key: runs the process pipeline for the key to determine a new dynamic
|
||||
* name.
|
||||
* name. If the new dynamic name is NULL then the result of the sub_process
|
||||
* pipeline is ignored.
|
||||
* - include_source: (optional) If TRUE, all source plugin configuration and
|
||||
* values will be copied into the sub-processed row in a new property named
|
||||
* for the source_key configuration value (see below). Defaults to FALSE.
|
||||
@@ -143,7 +144,8 @@ use Drupal\migrate\Row;
|
||||
* you need to change the key, it is possible for the returned array to be keyed
|
||||
* by one of the transformed values in the sub-array. For the same source data
|
||||
* used in the previous example, the migration below would result to keys
|
||||
* 'filter_2' and 'filter_0'.
|
||||
* 'filter_2' and 'filter_0'. If the value for 'id' is NULL the result of the
|
||||
* sub_process pipeline is ignored.
|
||||
* @code
|
||||
* process:
|
||||
* filters:
|
||||
@@ -207,7 +209,13 @@ class SubProcess extends ProcessPluginBase {
|
||||
if (array_key_exists('key', $this->configuration)) {
|
||||
$key = $this->transformKey($key, $migrate_executable, $new_row);
|
||||
}
|
||||
$return[$key] = $destination;
|
||||
// Do not save the result if the key is NULL. The configured process
|
||||
// pipeline used in transformKey() will return NULL if a
|
||||
// MigrateSkipProcessException is thrown.
|
||||
// @see \Drupal\filter\Plugin\migrate\process\FilterID
|
||||
if ($key !== NULL) {
|
||||
$return[$key] = $destination;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
|
||||
@@ -452,7 +452,7 @@ abstract class SqlBase extends SourcePluginBase implements ContainerFactoryPlugi
|
||||
}
|
||||
|
||||
foreach (['username', 'password', 'host', 'port', 'namespace', 'driver'] as $key) {
|
||||
if (isset($source_database_options[$key])) {
|
||||
if (isset($source_database_options[$key]) && isset($id_map_database_options[$key])) {
|
||||
if ($id_map_database_options[$key] != $source_database_options[$key]) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -12,10 +12,18 @@ use Drupal\migrate\Plugin\MigrateProcessInterface;
|
||||
* transform a human provided name into a machine name, look up an identifier
|
||||
* in a previous migration and so on.
|
||||
*
|
||||
* Process plugins extending this class can use any number of methods, thus
|
||||
* offering different alternative ways of processing. In this case, the
|
||||
* transform() method should not be implemented, and the plugin configuration
|
||||
* must provide the name of the method to be called via the "method" key. Each
|
||||
* method must have the same signature as transform().
|
||||
*
|
||||
* @see https://www.drupal.org/node/2129651
|
||||
* @see \Drupal\migrate\Plugin\MigratePluginManager
|
||||
* @see \Drupal\migrate\Plugin\MigrateProcessInterface
|
||||
* @see \Drupal\migrate\Annotation\MigrateProcessPlugin
|
||||
* @see \Drupal\migrate\Plugin\migrate\process\SkipOnEmpty
|
||||
* @see d7_field_formatter_settings.yml
|
||||
* @see plugin_api
|
||||
*
|
||||
* @ingroup migration
|
||||
|
||||
+2
-2
@@ -21,8 +21,8 @@ function migrate_prepare_row_test_migrate_prepare_row(Row $row, MigrateSourceInt
|
||||
// Record mapping but don't record a message.
|
||||
throw new MigrateSkipRowException('', TRUE);
|
||||
}
|
||||
elseif ($data == 'skip_and_dont_record') {
|
||||
elseif ($data == 'skip_and_do_not_record') {
|
||||
// Don't record mapping but record a message.
|
||||
throw new MigrateSkipRowException('skip_and_dont_record message', FALSE);
|
||||
throw new MigrateSkipRowException('skip_and_do_not_record message', FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ class TestSkipRowProcess extends ProcessPluginBase {
|
||||
if ($data == 'skip_and_record (use plugin)') {
|
||||
throw new MigrateSkipRowException('', TRUE);
|
||||
}
|
||||
elseif ($data == 'skip_and_dont_record (use plugin)') {
|
||||
elseif ($data == 'skip_and_do_not_record (use plugin)') {
|
||||
throw new MigrateSkipRowException('', FALSE);
|
||||
}
|
||||
return $value;
|
||||
|
||||
@@ -33,7 +33,7 @@ class MigrateSkipRowTest extends KernelTestBase {
|
||||
'plugin' => 'embedded_data',
|
||||
'data_rows' => [
|
||||
['id' => '1', 'data' => 'skip_and_record'],
|
||||
['id' => '2', 'data' => 'skip_and_dont_record'],
|
||||
['id' => '2', 'data' => 'skip_and_do_not_record'],
|
||||
],
|
||||
'ids' => [
|
||||
'id' => ['type' => 'string'],
|
||||
@@ -69,7 +69,7 @@ class MigrateSkipRowTest extends KernelTestBase {
|
||||
$messages = $id_map_plugin->getMessages(['id' => 2])->fetchAll();
|
||||
$this->assertCount(1, $messages);
|
||||
$message = reset($messages);
|
||||
$this->assertEquals('skip_and_dont_record message', $message->message);
|
||||
$this->assertEquals('skip_and_do_not_record message', $message->message);
|
||||
$this->assertEquals(MigrationInterface::MESSAGE_INFORMATIONAL, $message->level);
|
||||
|
||||
// Insert a custom processor in the process flow.
|
||||
@@ -80,7 +80,7 @@ class MigrateSkipRowTest extends KernelTestBase {
|
||||
// Change data to avoid triggering again hook_migrate_prepare_row().
|
||||
$definition['source']['data_rows'] = [
|
||||
['id' => '1', 'data' => 'skip_and_record (use plugin)'],
|
||||
['id' => '2', 'data' => 'skip_and_dont_record (use plugin)'],
|
||||
['id' => '2', 'data' => 'skip_and_do_not_record (use plugin)'],
|
||||
];
|
||||
$migration = \Drupal::service('plugin.manager.migration')->createStubMigration($definition);
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ class RouteTest extends KernelTestBase {
|
||||
$executable = $this->prophesize(MigrateExecutableInterface::class)->reveal();
|
||||
|
||||
$plugin = new Route([], 'route', [], $migration, $pathValidator);
|
||||
$actual = $plugin->transform($value, $executable, $row, 'destinationproperty');
|
||||
$actual = $plugin->transform($value, $executable, $row, 'destination_property');
|
||||
return $actual;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,12 +66,16 @@ class MigrateExecutableTest extends MigrateTestCase {
|
||||
$source->expects($this->once())
|
||||
->method('rewind')
|
||||
->will($this->throwException(new \Exception($exception_message)));
|
||||
// The exception message contains the line number where it is thrown. Save
|
||||
// it for the testing the exception message.
|
||||
$line = (__LINE__) - 3;
|
||||
|
||||
$this->migration->expects($this->any())
|
||||
->method('getSourcePlugin')
|
||||
->will($this->returnValue($source));
|
||||
|
||||
// Ensure that a message with the proper message was added.
|
||||
$exception_message .= " in " . __FILE__ . " line $line";
|
||||
$this->message->expects($this->once())
|
||||
->method('display')
|
||||
->with("Migration failed with source plugin exception: " . Html::escape($exception_message));
|
||||
|
||||
@@ -405,15 +405,15 @@ class RowTest extends UnitTestCase {
|
||||
'destination_value_3',
|
||||
],
|
||||
],
|
||||
'Mix of keys including non-existant' => [
|
||||
'Mix of keys including non-existent' => [
|
||||
'keys' => [
|
||||
'shared_key_1',
|
||||
'@shared_key_1',
|
||||
'@@shared_key_2',
|
||||
'@@@shared_key_2',
|
||||
'@@@@@@@@@shared_key_3',
|
||||
'non_existant_source_key',
|
||||
'@non_existant_destination_key',
|
||||
'non_existent_source_key',
|
||||
'@non_existent_destination_key',
|
||||
],
|
||||
'values' => [
|
||||
'source_shared_value_1',
|
||||
|
||||
@@ -35,7 +35,7 @@ class ArrayBuildTest extends MigrateProcessTestCase {
|
||||
'Foo' => 'Bar',
|
||||
'foo bar' => 'bar foo',
|
||||
];
|
||||
$value = $this->plugin->transform($source, $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$value = $this->plugin->transform($source, $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame($value, $expected);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class ArrayBuildTest extends MigrateProcessTestCase {
|
||||
];
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage("The key 'foo' does not exist");
|
||||
$this->plugin->transform($source, $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$this->plugin->transform($source, $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,7 +60,7 @@ class ArrayBuildTest extends MigrateProcessTestCase {
|
||||
];
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage("The key 'bar' does not exist");
|
||||
$this->plugin->transform($source, $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$this->plugin->transform($source, $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,7 +70,7 @@ class ArrayBuildTest extends MigrateProcessTestCase {
|
||||
$source = ['foo' => 'bar'];
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('The input should be an array of arrays');
|
||||
$this->plugin->transform($source, $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$this->plugin->transform($source, $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,7 +80,7 @@ class ArrayBuildTest extends MigrateProcessTestCase {
|
||||
$source = 'foo';
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('The input should be an array of arrays');
|
||||
$this->plugin->transform($source, $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$this->plugin->transform($source, $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class CallbackTest extends MigrateProcessTestCase {
|
||||
public function testCallback($callable) {
|
||||
$configuration = ['callable' => $callable];
|
||||
$this->plugin = new Callback($configuration, 'map', []);
|
||||
$value = $this->plugin->transform('FooBar', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$value = $this->plugin->transform('FooBar', $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame('foobar', $value);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class ConcatTest extends MigrateProcessTestCase {
|
||||
* Test concat works without a delimiter.
|
||||
*/
|
||||
public function testConcatWithoutDelimiter() {
|
||||
$value = $this->plugin->transform(['foo', 'bar'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$value = $this->plugin->transform(['foo', 'bar'], $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame('foobar', $value);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class ConcatTest extends MigrateProcessTestCase {
|
||||
*/
|
||||
public function testConcatWithNonArray() {
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->plugin->transform('foo', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$this->plugin->transform('foo', $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,7 @@ class ConcatTest extends MigrateProcessTestCase {
|
||||
*/
|
||||
public function testConcatWithDelimiter() {
|
||||
$this->plugin->setDelimiter('_');
|
||||
$value = $this->plugin->transform(['foo', 'bar'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$value = $this->plugin->transform(['foo', 'bar'], $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame('foo_bar', $value);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class DefaultValueTest extends MigrateProcessTestCase {
|
||||
*/
|
||||
public function testDefaultValue($configuration, $expected_value, $value) {
|
||||
$process = new DefaultValue($configuration, 'default_value', []);
|
||||
$value = $process->transform($value, $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$value = $process->transform($value, $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame($expected_value, $value);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class ExplodeTest extends MigrateProcessTestCase {
|
||||
* Test explode transform process works.
|
||||
*/
|
||||
public function testTransform() {
|
||||
$value = $this->plugin->transform('foo,bar,tik', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$value = $this->plugin->transform('foo,bar,tik', $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame(['foo', 'bar', 'tik'], $value);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class ExplodeTest extends MigrateProcessTestCase {
|
||||
*/
|
||||
public function testTransformLimit() {
|
||||
$plugin = new Explode(['delimiter' => '_', 'limit' => 2], 'map', []);
|
||||
$value = $plugin->transform('foo_bar_tik', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$value = $plugin->transform('foo_bar_tik', $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame(['foo', 'bar_tik'], $value);
|
||||
}
|
||||
|
||||
@@ -45,10 +45,10 @@ class ExplodeTest extends MigrateProcessTestCase {
|
||||
* Test if the explode process can be chained with a handles_multiple process.
|
||||
*/
|
||||
public function testChainedTransform() {
|
||||
$exploded = $this->plugin->transform('foo,bar,tik', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$exploded = $this->plugin->transform('foo,bar,tik', $this->migrateExecutable, $this->row, 'destination_property');
|
||||
|
||||
$concat = new Concat([], 'map', []);
|
||||
$concatenated = $concat->transform($exploded, $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$concatenated = $concat->transform($exploded, $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame('foobartik', $concatenated);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class ExplodeTest extends MigrateProcessTestCase {
|
||||
public function testExplodeWithNonString() {
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('is not a string');
|
||||
$this->plugin->transform(['foo'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$this->plugin->transform(['foo'], $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,7 +69,7 @@ class ExplodeTest extends MigrateProcessTestCase {
|
||||
public function testExplodeWithNonStrictAndEmptySource($value, $expected) {
|
||||
$plugin = new Explode(['delimiter' => '|', 'strict' => FALSE], 'map', []);
|
||||
|
||||
$processed = $plugin->transform($value, $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$processed = $plugin->transform($value, $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame($expected, $processed);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ class ExplodeTest extends MigrateProcessTestCase {
|
||||
$plugin = new Explode(['delimiter' => '|', 'strict' => FALSE], 'map', []);
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('cannot be casted to a string');
|
||||
$processed = $plugin->transform(['foo'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$processed = $plugin->transform(['foo'], $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame(['foo'], $processed);
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ class ExplodeTest extends MigrateProcessTestCase {
|
||||
*/
|
||||
public function testExplodeWithStrictAndEmptyString() {
|
||||
$plugin = new Explode(['delimiter' => '|'], 'map', []);
|
||||
$processed = $plugin->transform('', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$processed = $plugin->transform('', $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame([''], $processed);
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ class ExplodeTest extends MigrateProcessTestCase {
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('delimiter is empty');
|
||||
$plugin = new Explode(['delimiter' => ''], 'map', []);
|
||||
$plugin->transform('foo,bar', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$plugin->transform('foo,bar', $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class ExtractTest extends MigrateProcessTestCase {
|
||||
* Tests successful extraction.
|
||||
*/
|
||||
public function testExtract() {
|
||||
$value = $this->plugin->transform(['foo' => 'bar'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$value = $this->plugin->transform(['foo' => 'bar'], $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame('bar', $value);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class ExtractTest extends MigrateProcessTestCase {
|
||||
public function testExtractFromString() {
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('Input should be an array.');
|
||||
$this->plugin->transform('bar', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$this->plugin->transform('bar', $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,7 +43,7 @@ class ExtractTest extends MigrateProcessTestCase {
|
||||
public function testExtractFail() {
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('Array index missing, extraction failed.');
|
||||
$this->plugin->transform(['bar' => 'foo'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$this->plugin->transform(['bar' => 'foo'], $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,7 +51,7 @@ class ExtractTest extends MigrateProcessTestCase {
|
||||
*/
|
||||
public function testExtractFailDefault() {
|
||||
$plugin = new Extract(['index' => ['foo'], 'default' => 'test'], 'map', []);
|
||||
$value = $plugin->transform(['bar' => 'foo'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$value = $plugin->transform(['bar' => 'foo'], $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame('test', $value, '');
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class FlattenTest extends MigrateProcessTestCase {
|
||||
*/
|
||||
public function testFlatten() {
|
||||
$plugin = new Flatten([], 'flatten', []);
|
||||
$flattened = $plugin->transform([1, 2, [3, 4, [5]], [], [7, 8]], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$flattened = $plugin->transform([1, 2, [3, 4, [5]], [], [7, 8]], $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame([1, 2, 3, 4, 5, 7, 8], $flattened);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class GetTest extends MigrateProcessTestCase {
|
||||
->with('test')
|
||||
->will($this->returnValue('source_value'));
|
||||
$this->plugin = new Get(['source' => 'test'], '', []);
|
||||
$value = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$value = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame('source_value', $value);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class GetTest extends MigrateProcessTestCase {
|
||||
->will($this->returnCallback(function ($argument) use ($map) {
|
||||
return $map[$argument];
|
||||
}));
|
||||
$value = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$value = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame(['source_value1', 'source_value2'], $value);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ class GetTest extends MigrateProcessTestCase {
|
||||
->with('@@test')
|
||||
->will($this->returnValue('source_value'));
|
||||
$this->plugin = new Get(['source' => '@@test'], '', []);
|
||||
$value = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$value = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame('source_value', $value);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class GetTest extends MigrateProcessTestCase {
|
||||
->will($this->returnCallback(function ($argument) use ($map) {
|
||||
return $map[$argument];
|
||||
}));
|
||||
$value = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$value = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame(['source_value1', 'source_value2', 'source_value3', 'source_value4'], $value);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ class GetTest extends MigrateProcessTestCase {
|
||||
->willReturnOnConsecutiveCalls('val1', 'val2');
|
||||
|
||||
$this->plugin = new Get(['source' => $source], '', []);
|
||||
$return = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$return = $this->plugin->transform(NULL, $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame($expected_value, $return);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ class MachineNameTest extends MigrateProcessTestCase {
|
||||
->will($this->returnValue($human_name_ascii . 'aeo'));
|
||||
|
||||
$plugin = new MachineName([], 'machine_name', [], $this->transliteration);
|
||||
$value = $plugin->transform($human_name, $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$value = $plugin->transform($human_name, $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertEquals($expected_result, $value);
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ class MenuLinkParentTest extends MigrateProcessTestCase {
|
||||
$plugin = new MenuLinkParent([], 'map', [], $this->migrateLookup->reveal(), $this->menuLinkManager->reveal(), $this->menuLinkStorage->reveal(), $this->migration->reveal());
|
||||
$this->expectException(MigrateSkipRowException::class);
|
||||
$this->expectExceptionMessage("No parent link found for plid '1' in menu 'admin'.");
|
||||
$plugin->transform([1, 'admin', NULL], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$plugin->transform([1, 'admin', NULL], $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +92,7 @@ class MenuLinkParentTest extends MigrateProcessTestCase {
|
||||
$this->menuLinkManager->createInstance('menu_link_content:fe151460-dfa2-4133-8864-c1746f28ab27')->willReturn($plugin->reveal());
|
||||
$plugin = new MenuLinkParent([], 'map', [], $this->migrateLookup->reveal(), $this->menuLinkManager->reveal(), $this->menuLinkStorage->reveal(), $this->migration->reveal());
|
||||
|
||||
$result = $plugin->transform([1, 'admin', 'http://example.com'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$result = $plugin->transform([1, 'admin', 'http://example.com'], $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertEquals('menu_link_content:fe151460-dfa2-4133-8864-c1746f28ab27', $result);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class NullCoalesceTest extends MigrateProcessTestCase {
|
||||
*/
|
||||
public function testExceptionOnInvalidValue() {
|
||||
$this->expectException(MigrateException::class);
|
||||
(new NullCoalesce([], 'null_coalesce', []))->transform('invalid', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
(new NullCoalesce([], 'null_coalesce', []))->transform('invalid', $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,7 +40,7 @@ class NullCoalesceTest extends MigrateProcessTestCase {
|
||||
*/
|
||||
public function testTransform(array $source, $expected_result) {
|
||||
$plugin = new NullCoalesce([], 'null_coalesce', []);
|
||||
$result = $plugin->transform($source, $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$result = $plugin->transform($source, $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame($expected_result, $result);
|
||||
}
|
||||
|
||||
@@ -83,10 +83,10 @@ class NullCoalesceTest extends MigrateProcessTestCase {
|
||||
*/
|
||||
public function testTransformWithDefault() {
|
||||
$plugin = new NullCoalesce(['default_value' => 'default'], 'null_coalesce', []);
|
||||
$result = $plugin->transform([NULL, NULL, 'Test', 'Test 2'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$result = $plugin->transform([NULL, NULL, 'Test', 'Test 2'], $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame('Test', $result);
|
||||
|
||||
$this->assertSame('default', $plugin->transform([NULL, NULL], $this->migrateExecutable, $this->row, 'destinationproperty'));
|
||||
$this->assertSame('default', $plugin->transform([NULL, NULL], $this->migrateExecutable, $this->row, 'destination_property'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class SkipOnEmptyTest extends MigrateProcessTestCase {
|
||||
$configuration['method'] = 'process';
|
||||
$this->expectException(MigrateSkipProcessException::class);
|
||||
(new SkipOnEmpty($configuration, 'skip_on_empty', []))
|
||||
->transform('', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
->transform('', $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@ class SkipOnEmptyTest extends MigrateProcessTestCase {
|
||||
public function testProcessBypassesOnNonEmpty() {
|
||||
$configuration['method'] = 'process';
|
||||
$value = (new SkipOnEmpty($configuration, 'skip_on_empty', []))
|
||||
->transform(' ', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
->transform(' ', $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame(' ', $value);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class SkipOnEmptyTest extends MigrateProcessTestCase {
|
||||
$configuration['method'] = 'row';
|
||||
$this->expectException(MigrateSkipRowException::class);
|
||||
(new SkipOnEmpty($configuration, 'skip_on_empty', []))
|
||||
->transform('', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
->transform('', $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,7 +50,7 @@ class SkipOnEmptyTest extends MigrateProcessTestCase {
|
||||
public function testRowBypassesOnNonEmpty() {
|
||||
$configuration['method'] = 'row';
|
||||
$value = (new SkipOnEmpty($configuration, 'skip_on_empty', []))
|
||||
->transform(' ', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
->transform(' ', $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame(' ', $value);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ class SkipOnEmptyTest extends MigrateProcessTestCase {
|
||||
];
|
||||
$process = new SkipOnEmpty($configuration, 'skip_on_empty', []);
|
||||
$this->expectException(MigrateSkipRowException::class);
|
||||
$process->transform('', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$process->transform('', $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,7 +81,7 @@ class SkipOnEmptyTest extends MigrateProcessTestCase {
|
||||
$process = new SkipOnEmpty($configuration, 'skip_on_empty', []);
|
||||
$this->expectException(MigrateSkipRowException::class);
|
||||
$this->expectExceptionMessage('The value is empty');
|
||||
$process->transform('', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$process->transform('', $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class SkipRowIfNotSetTest extends MigrateProcessTestCase {
|
||||
];
|
||||
$process = new SkipRowIfNotSet($configuration, 'skip_row_if_not_set', []);
|
||||
$this->expectException(MigrateSkipRowException::class);
|
||||
$process->transform('', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$process->transform('', $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,7 +40,7 @@ class SkipRowIfNotSetTest extends MigrateProcessTestCase {
|
||||
$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, 'destinationproperty');
|
||||
$process->transform('', $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class StaticMapTest extends MigrateProcessTestCase {
|
||||
* Tests map when the source is a string.
|
||||
*/
|
||||
public function testMapWithSourceString() {
|
||||
$value = $this->plugin->transform('foo', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$value = $this->plugin->transform('foo', $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame(['bar' => 'baz'], $value);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class StaticMapTest extends MigrateProcessTestCase {
|
||||
* Tests map when the source is a list.
|
||||
*/
|
||||
public function testMapWithSourceList() {
|
||||
$value = $this->plugin->transform(['foo', 'bar'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$value = $this->plugin->transform(['foo', 'bar'], $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame('baz', $value);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class StaticMapTest extends MigrateProcessTestCase {
|
||||
*/
|
||||
public function testMapwithEmptySource() {
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->plugin->transform([], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$this->plugin->transform([], $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,8 +52,8 @@ class StaticMapTest extends MigrateProcessTestCase {
|
||||
*/
|
||||
public function testMapwithInvalidSource() {
|
||||
$this->expectException(MigrateSkipRowException::class);
|
||||
$this->expectExceptionMessage(sprintf("No static mapping found for '%s' and no default value provided for destination '%s'.", Variable::export(['bar']), 'destinationproperty'));
|
||||
$this->plugin->transform(['bar'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$this->expectExceptionMessage(sprintf("No static mapping found for '%s' and no default value provided for destination '%s'.", Variable::export(['bar']), 'destination_property'));
|
||||
$this->plugin->transform(['bar'], $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ class StaticMapTest extends MigrateProcessTestCase {
|
||||
$configuration['map']['foo']['bar'] = 'baz';
|
||||
$configuration['default_value'] = 'test';
|
||||
$this->plugin = new StaticMap($configuration, 'map', []);
|
||||
$value = $this->plugin->transform(['bar'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$value = $this->plugin->transform(['bar'], $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame('test', $value);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ class StaticMapTest extends MigrateProcessTestCase {
|
||||
$configuration['map']['foo']['bar'] = 'baz';
|
||||
$configuration['default_value'] = NULL;
|
||||
$this->plugin = new StaticMap($configuration, 'map', []);
|
||||
$value = $this->plugin->transform(['bar'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$value = $this->plugin->transform(['bar'], $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertNull($value);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ class StaticMapTest extends MigrateProcessTestCase {
|
||||
$this->plugin = new StaticMap($configuration, 'map', []);
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('Setting both default_value and bypass is invalid.');
|
||||
$this->plugin->transform(['bar'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$this->plugin->transform(['bar'], $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -125,4 +125,73 @@ class SubProcessTest extends MigrateTestCase {
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the sub_process process plugin.
|
||||
*
|
||||
* @dataProvider providerTestNotFoundSubProcess
|
||||
*/
|
||||
public function testNotFoundSubProcess($process_configuration, $source_values = []) {
|
||||
$migration = $this->getMigration();
|
||||
// Set up the properties for the sub_process.
|
||||
$plugin = new SubProcess($process_configuration, 'sub_process', []);
|
||||
// Manually create the plugins. Migration::getProcessPlugins does this
|
||||
// normally but the plugin system is not available.
|
||||
foreach ($process_configuration['process'] as $destination => $source) {
|
||||
$sub_process_plugins[$destination][] = new Get(['source' => $source], 'get', []);
|
||||
}
|
||||
$migration->expects($this->at(1))
|
||||
->method('getProcessPlugins')
|
||||
->willReturn($sub_process_plugins);
|
||||
// Set up the key plugins.
|
||||
if (array_key_exists('key', $process_configuration)) {
|
||||
$key_plugin['key'][] = new Get(['source' => '@id'], 'get', []);
|
||||
$migration->expects($this->at(2))
|
||||
->method('getProcessPlugins')
|
||||
->will($this->returnValue($key_plugin));
|
||||
}
|
||||
$event_dispatcher = $this->createMock(EventDispatcherInterface::class);
|
||||
$migrate_executable = new MigrateExecutable($migration, $this->createMock(MigrateMessageInterface::class), $event_dispatcher);
|
||||
|
||||
// The current value of the pipeline.
|
||||
$current_value = [
|
||||
[
|
||||
'source_foo' => 'test',
|
||||
'source_id' => NULL,
|
||||
] + $source_values,
|
||||
];
|
||||
// This is not used but the interface requires it, so create an empty row.
|
||||
$row = new Row($source_values);
|
||||
|
||||
// After transformation, check to make sure that source_foo and source_id's
|
||||
// values ended up in the proper destinations, and that the value of the
|
||||
// key (@id) is the same as the destination ID (42).
|
||||
$new_value = $plugin->transform($current_value, $migrate_executable, $row, 'test');
|
||||
$this->assertArrayEquals([], $new_value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for testNotFoundSubProcess().
|
||||
*/
|
||||
public function providerTestNotFoundSubProcess() {
|
||||
return [
|
||||
'no key' => [
|
||||
'process configuration' => [
|
||||
'process' => [
|
||||
'foo' => 'source_foo',
|
||||
],
|
||||
'key' => '@id',
|
||||
],
|
||||
],
|
||||
'lookup returns NULL' => [
|
||||
'process configuration' => [
|
||||
'process' => [
|
||||
'foo' => 'source_foo',
|
||||
'id' => 'source_id',
|
||||
],
|
||||
'key' => '@id',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class SubstrTest extends MigrateProcessTestCase {
|
||||
$configuration['start'] = $start;
|
||||
$configuration['length'] = $length;
|
||||
$this->plugin = new Substr($configuration, 'map', []);
|
||||
$value = $this->plugin->transform('Captain Janeway', $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$value = $this->plugin->transform('Captain Janeway', $this->migrateExecutable, $this->row, 'destination_property');
|
||||
$this->assertSame($expected, $value);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class SubstrTest extends MigrateProcessTestCase {
|
||||
$this->plugin = new Substr($configuration, 'map', []);
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('The input value must be a string.');
|
||||
$this->plugin->transform(['Captain Janeway'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$this->plugin->transform(['Captain Janeway'], $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,7 +73,7 @@ class SubstrTest extends MigrateProcessTestCase {
|
||||
$this->plugin = new Substr($configuration, 'map', []);
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('The start position configuration value should be an integer. Omit this key to capture from the beginning of the string.');
|
||||
$this->plugin->transform(['foo'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$this->plugin->transform(['foo'], $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,7 +84,7 @@ class SubstrTest extends MigrateProcessTestCase {
|
||||
$this->plugin = new Substr($configuration, 'map', []);
|
||||
$this->expectException(MigrateException::class);
|
||||
$this->expectExceptionMessage('The character length configuration value should be an integer. Omit this key to capture from the start position to the end of the string.');
|
||||
$this->plugin->transform(['foo'], $this->migrateExecutable, $this->row, 'destinationproperty');
|
||||
$this->plugin->transform(['foo'], $this->migrateExecutable, $this->row, 'destination_property');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user