.../filter/src/Plugin/migrate/process/FilterID.php | 8 ++++---- .../Kernel/Plugin/migrate/process/FilterIdTest.php | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/core/modules/filter/src/Plugin/migrate/process/FilterID.php b/core/modules/filter/src/Plugin/migrate/process/FilterID.php index 69c8c44f50..9a95bfe967 100644 --- a/core/modules/filter/src/Plugin/migrate/process/FilterID.php +++ b/core/modules/filter/src/Plugin/migrate/process/FilterID.php @@ -223,7 +223,7 @@ protected static function getSourceFilterType($filter_id) { // https://www.drupal.org/project/float_filter case 'float_filter': return FilterInterface::TYPE_TRANSFORM_REVERSIBLE; - // https://www.drupal.org/project/footnotes + // https://www.drupal.org/project/footnotes case 'filter_footnotes': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; // https://www.drupal.org/project/forena @@ -327,7 +327,7 @@ protected static function getSourceFilterType($filter_id) { // https://www.drupal.org/project/node_field_embed case 'node_field_embed': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; - // https://www.drupal.org/project/noindex_external_links + // https://www.drupal.org/project/noindex_external_links case 'external_links': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; // https://www.drupal.org/project/noreferrer @@ -357,7 +357,7 @@ protected static function getSourceFilterType($filter_id) { // https://www.drupal.org/project/prettify case 'prettify': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; - // https://www.drupal.org/project/rel_to_abs + // https://www.drupal.org/project/rel_to_abs case 'rel_to_abs': return FilterInterface::TYPE_TRANSFORM_REVERSIBLE; // https://www.drupal.org/project/rollover_filter @@ -393,7 +393,7 @@ protected static function getSourceFilterType($filter_id) { // https://www.drupal.org/project/spoiler case 'spoiler': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; - // https://www.drupal.org/project/tableofcontents + // https://www.drupal.org/project/tableofcontents case 'filter_toc': return FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE; // https://www.drupal.org/project/tables diff --git a/core/modules/filter/tests/src/Kernel/Plugin/migrate/process/FilterIdTest.php b/core/modules/filter/tests/src/Kernel/Plugin/migrate/process/FilterIdTest.php index 2f8cee39bc..3578add647 100644 --- a/core/modules/filter/tests/src/Kernel/Plugin/migrate/process/FilterIdTest.php +++ b/core/modules/filter/tests/src/Kernel/Plugin/migrate/process/FilterIdTest.php @@ -5,6 +5,7 @@ use Drupal\filter\Plugin\migrate\process\FilterID; use Drupal\KernelTests\KernelTestBase; use Drupal\migrate\MigrateExecutableInterface; +use Drupal\migrate\MigrateSkipProcessException; use Drupal\migrate\Plugin\MigrationInterface; use Drupal\migrate\Row; @@ -61,6 +62,18 @@ public function testTransform($value, $expected_value, $invalid_id = NULL) { ]; $plugin = FilterID::create($this->container, $configuration, 'filter_id', []); + if ($expected_value instanceof MigrateSkipProcessException) { + $this->executable + ->expects($this->exactly(1)) + ->method('saveMessage') + ->with( + sprintf('Filter %s could not be mapped to an existing filter plugin; omitted since it is a transformation-only filter. Install and configure a successor after the migration.', $value), + MigrationInterface::MESSAGE_INFORMATIONAL + ); + $this->expectException(MigrateSkipProcessException::class); + $this->expectExceptionMessage(sprintf("The transformation-only filter %s was skipped.", $value)); + } + if (isset($invalid_id)) { $this->executable ->expects($this->exactly(1)) @@ -110,6 +123,14 @@ public function provideFilters() { 'filter_null', 'filter:1', ], + 'transformation-only D7 contrib filter' => [ + 'editor_align', + new MigrateSkipProcessException('The transformation-only filter editor_align was skipped.'), + ], + 'non-transformation-only D7 contrib filter' => [ + 'bbcode', + 'filter_null', + ], ]; }