Loading src/Plugin/migrate/process/SkipOnValue.php +10 −7 Changes for src/Plugin/migrate/process/SkipOnValue.php: 10 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -61,11 +61,18 @@ class SkipOnValue extends ProcessPluginBase { /** * {@inheritdoc} */ public function row($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { if (empty($this->configuration['value']) && !array_key_exists('value', $this->configuration)) { throw new MigrateException('Skip on value plugin is missing value configuration.'); public function __construct(array $configuration, $plugin_id, $plugin_definition) { if (empty($configuration['value']) && !array_key_exists('value', $configuration)) { throw new \InvalidArgumentException('Skip on value plugin is missing value configuration.'); } parent::__construct($configuration, $plugin_id, $plugin_definition); } /** * {@inheritdoc} */ public function row($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { if (is_array($this->configuration['value'])) { $value_in_array = FALSE; $not_equals = isset($this->configuration['not_equals']); Loading @@ -89,10 +96,6 @@ class SkipOnValue extends ProcessPluginBase { * {@inheritdoc} */ public function process($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { if (empty($this->configuration['value']) && !array_key_exists('value', $this->configuration)) { throw new MigrateException('Skip on value plugin is missing value configuration.'); } if (is_array($this->configuration['value'])) { $value_in_array = FALSE; $not_equals = isset($this->configuration['not_equals']); Loading tests/src/Unit/process/SkipOnValueTest.php +6 −15 Changes for tests/src/Unit/process/SkipOnValueTest.php: 6 added lines, 15 removed lines. Original line number Diff line number Diff line Loading @@ -123,23 +123,14 @@ class SkipOnValueTest extends MigrateProcessTestCase { } /** * @covers ::row * @covers ::__construct */ public function testRequiredRowConfiguration(): void { public function testRequiredConfiguration() { // It doesn't meter which method we will put here, because it should throw // error on contraction of Plugin. $configuration['method'] = 'row'; $this->expectException(MigrateException::class); (new SkipOnValue($configuration, 'skip_on_value', [])) ->transform('sourcevalue', $this->migrateExecutable, $this->row, 'destinationproperty'); } /** * @covers ::process */ public function testRequiredProcessConfiguration(): void { $configuration['method'] = 'process'; $this->expectException(MigrateException::class); (new SkipOnValue($configuration, 'skip_on_value', [])) ->transform('sourcevalue', $this->migrateExecutable, $this->row, 'destinationproperty'); $this->expectException(\InvalidArgumentException::class); (new SkipOnValue($configuration, 'skip_on_value', [])); } } Loading
src/Plugin/migrate/process/SkipOnValue.php +10 −7 Changes for src/Plugin/migrate/process/SkipOnValue.php: 10 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -61,11 +61,18 @@ class SkipOnValue extends ProcessPluginBase { /** * {@inheritdoc} */ public function row($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { if (empty($this->configuration['value']) && !array_key_exists('value', $this->configuration)) { throw new MigrateException('Skip on value plugin is missing value configuration.'); public function __construct(array $configuration, $plugin_id, $plugin_definition) { if (empty($configuration['value']) && !array_key_exists('value', $configuration)) { throw new \InvalidArgumentException('Skip on value plugin is missing value configuration.'); } parent::__construct($configuration, $plugin_id, $plugin_definition); } /** * {@inheritdoc} */ public function row($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { if (is_array($this->configuration['value'])) { $value_in_array = FALSE; $not_equals = isset($this->configuration['not_equals']); Loading @@ -89,10 +96,6 @@ class SkipOnValue extends ProcessPluginBase { * {@inheritdoc} */ public function process($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) { if (empty($this->configuration['value']) && !array_key_exists('value', $this->configuration)) { throw new MigrateException('Skip on value plugin is missing value configuration.'); } if (is_array($this->configuration['value'])) { $value_in_array = FALSE; $not_equals = isset($this->configuration['not_equals']); Loading
tests/src/Unit/process/SkipOnValueTest.php +6 −15 Changes for tests/src/Unit/process/SkipOnValueTest.php: 6 added lines, 15 removed lines. Original line number Diff line number Diff line Loading @@ -123,23 +123,14 @@ class SkipOnValueTest extends MigrateProcessTestCase { } /** * @covers ::row * @covers ::__construct */ public function testRequiredRowConfiguration(): void { public function testRequiredConfiguration() { // It doesn't meter which method we will put here, because it should throw // error on contraction of Plugin. $configuration['method'] = 'row'; $this->expectException(MigrateException::class); (new SkipOnValue($configuration, 'skip_on_value', [])) ->transform('sourcevalue', $this->migrateExecutable, $this->row, 'destinationproperty'); } /** * @covers ::process */ public function testRequiredProcessConfiguration(): void { $configuration['method'] = 'process'; $this->expectException(MigrateException::class); (new SkipOnValue($configuration, 'skip_on_value', [])) ->transform('sourcevalue', $this->migrateExecutable, $this->row, 'destinationproperty'); $this->expectException(\InvalidArgumentException::class); (new SkipOnValue($configuration, 'skip_on_value', [])); } }