summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2017-07-03 13:00:47 +0100
committerNathaniel Catchpole2017-07-03 13:00:47 +0100
commit77043e422fd738c6404ea55778413261d178ba7b (patch)
tree71ad45b29c2a440fbe4600dd10d4186802fd03bd
parent85ee07cc134ad8995238d06614be6f3bc638e408 (diff)
Issue #2850312 by heddn, Charlotte17, ohthehugemanatee, Gribnif, mikeryan, kubrt, Jo Fitzgerald, michaelmallett, phenaproxima: d6_filter_format is hard coded, causing dependent migration to fail
-rw-r--r--core/modules/filter/src/Plugin/migrate/process/d6/FilterFormatPermission.php6
-rw-r--r--core/modules/filter/tests/src/Kernel/Migrate/d6/FilterFormatPermissionTest.php32
2 files changed, 37 insertions, 1 deletions
diff --git a/core/modules/filter/src/Plugin/migrate/process/d6/FilterFormatPermission.php b/core/modules/filter/src/Plugin/migrate/process/d6/FilterFormatPermission.php
index 8c7a160..ae8fb9d 100644
--- a/core/modules/filter/src/Plugin/migrate/process/d6/FilterFormatPermission.php
+++ b/core/modules/filter/src/Plugin/migrate/process/d6/FilterFormatPermission.php
@@ -40,12 +40,16 @@ class FilterFormatPermission extends ProcessPluginBase implements ContainerFacto
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+ $migration_plugin_configuration = $configuration + [
+ 'migration' => 'd6_filter_format',
+ ];
+
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$migration,
- $container->get('plugin.manager.migrate.process')->createInstance('migration', ['migration' => 'd6_filter_format'], $migration)
+ $container->get('plugin.manager.migrate.process')->createInstance('migration', $migration_plugin_configuration, $migration)
);
}
diff --git a/core/modules/filter/tests/src/Kernel/Migrate/d6/FilterFormatPermissionTest.php b/core/modules/filter/tests/src/Kernel/Migrate/d6/FilterFormatPermissionTest.php
new file mode 100644
index 0000000..80b0c7d
--- /dev/null
+++ b/core/modules/filter/tests/src/Kernel/Migrate/d6/FilterFormatPermissionTest.php
@@ -0,0 +1,32 @@
+<?php
+
+namespace Drupal\Tests\filter\Kernel\Migrate\d6;
+
+use Drupal\filter\Plugin\migrate\process\d6\FilterFormatPermission;
+use Drupal\migrate\Plugin\Migration;
+use Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase;
+
+/**
+ * Tests conversion of format serial to string id in permission name.
+ *
+ * @coversDefaultClass \Drupal\filter\Plugin\migrate\process\d6\FilterFormatPermission
+ *
+ * @group filter
+ */
+class FilterFormatPermissionTest extends MigrateDrupalTestBase {
+
+ /**
+ * Tests configurability of filter_format migration name.
+ *
+ * @covers ::__construct
+ */
+ public function testConfigurableFilterFormat() {
+ $migration = Migration::create($this->container, [], 'custom_migration', []);
+ $filterFormatPermissionMigration = FilterFormatPermission::create($this->container, ['migration' => 'custom_filter_format'], 'custom_filter_format', [], $migration);
+ $migrationPlugin = $this->readAttribute($filterFormatPermissionMigration, 'migrationPlugin');
+ $config = $this->readAttribute($migrationPlugin, 'configuration');
+
+ $this->assertEquals($config['migration'], 'custom_filter_format');
+ }
+
+}