diff --git a/core/modules/migrate/src/Plugin/migrate/process/MigrationLookup.php b/core/modules/migrate/src/Plugin/migrate/process/MigrationLookup.php index 3560d1c940b971ca9baaaa031b8aad34731decbc..2f9f296bca0ae0d807df9bc8dfd38921a013058f 100644 --- a/core/modules/migrate/src/Plugin/migrate/process/MigrationLookup.php +++ b/core/modules/migrate/src/Plugin/migrate/process/MigrationLookup.php @@ -244,7 +244,10 @@ public function transform($value, MigrateExecutableInterface $migrate_executable } catch (\LogicException $e) { // For BC reasons, we must allow attempting to stub a derived migration. - $destination_ids = []; + } + catch (PluginNotFoundException $e) { + // For BC reasons, we must allow attempting to stub a non-existent + // migration. } catch (MigrateException $e) { throw $e; diff --git a/core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasNoTranslationTest.php b/core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasNoTranslationTest.php new file mode 100644 index 0000000000000000000000000000000000000000..fc4cac6761c9af5c722247e3a14e973af6246067 --- /dev/null +++ b/core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasNoTranslationTest.php @@ -0,0 +1,20 @@ +<?php + +namespace Drupal\Tests\path\Kernel\Migrate\d7; + +/** + * Tests URL alias migration. + * + * @group path + */ +class MigrateUrlAliasNoTranslationTest extends MigrateUrlAliasTestBase { + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + $this->executeMigration('d7_url_alias'); + } + +} diff --git a/core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTest.php b/core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTest.php index b055e5cbf90b09dc9f4748391ebab48d115e7682..e48996e5186cdadf1955e51cf4bd772047359e25 100644 --- a/core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTest.php +++ b/core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTest.php @@ -2,27 +2,19 @@ namespace Drupal\Tests\path\Kernel\Migrate\d7; -use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase; - /** * Tests URL alias migration. * * @group path */ -class MigrateUrlAliasTest extends MigrateDrupal7TestBase { +class MigrateUrlAliasTest extends MigrateUrlAliasTestBase { /** * {@inheritdoc} */ public static $modules = [ 'content_translation', - 'language', - 'menu_ui', - // Required for translation migrations. 'migrate_drupal_multilingual', - 'node', - 'path', - 'text', ]; /** @@ -30,43 +22,12 @@ class MigrateUrlAliasTest extends MigrateDrupal7TestBase { */ protected function setUp() { parent::setUp(); - - $this->installEntitySchema('node'); - $this->installEntitySchema('path_alias'); - $this->installConfig('node'); - $this->installSchema('node', ['node_access']); - - $this->migrateUsers(FALSE); - $this->migrateContentTypes(); $this->executeMigrations([ - 'language', - 'd7_node', 'd7_node_translation', 'd7_url_alias', ]); } - /** - * Test the URL alias migration. - */ - public function testUrlAlias() { - $alias_storage = $this->container->get('path.alias_storage'); - - $path = $alias_storage->load([ - 'source' => '/taxonomy/term/4', - 'alias' => '/term33', - 'langcode' => 'und', - ]); - $this->assertIdentical('/taxonomy/term/4', $path['source']); - $this->assertIdentical('/term33', $path['alias']); - $this->assertIdentical('und', $path['langcode']); - - // Alias with no slash. - $path = $alias_storage->load(['alias' => '/source-noslash']); - $this->assertSame('/admin', $path['source']); - $this->assertSame('und', $path['langcode']); - } - /** * Test the URL alias migration with translated nodes. */ diff --git a/core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTestBase.php b/core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTestBase.php new file mode 100644 index 0000000000000000000000000000000000000000..315063ea2884b7724784160fd4f792b9b38cca40 --- /dev/null +++ b/core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTestBase.php @@ -0,0 +1,65 @@ +<?php + +namespace Drupal\Tests\path\Kernel\Migrate\d7; + +use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase; + +/** + * Tests URL alias migration. + * + * @group path + */ +abstract class MigrateUrlAliasTestBase extends MigrateDrupal7TestBase { + + /** + * {@inheritdoc} + */ + public static $modules = [ + 'language', + 'menu_ui', + 'node', + 'path', + 'text', + ]; + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + + $this->installEntitySchema('node'); + $this->installEntitySchema('path_alias'); + $this->installConfig('node'); + $this->installSchema('node', ['node_access']); + + $this->migrateUsers(FALSE); + $this->migrateContentTypes(); + $this->executeMigrations([ + 'language', + 'd7_node', + ]); + } + + /** + * Test the URL alias migration. + */ + public function testUrlAlias() { + $alias_storage = $this->container->get('path.alias_storage'); + + $path = $alias_storage->load([ + 'source' => '/taxonomy/term/4', + 'alias' => '/term33', + 'langcode' => 'und', + ]); + $this->assertIdentical('/taxonomy/term/4', $path['source']); + $this->assertIdentical('/term33', $path['alias']); + $this->assertIdentical('und', $path['langcode']); + + // Alias with no slash. + $path = $alias_storage->load(['alias' => '/source-noslash']); + $this->assertSame('/admin', $path['source']); + $this->assertSame('und', $path['langcode']); + } + +}