Skip to content
Snippets Groups Projects
Verified Commit 5a7951f2 authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3086952 by mikelutz, quietone: Migration Lookup should catch...

Issue #3086952 by mikelutz, quietone: Migration Lookup should catch PluginNotFoundException exceptions and ignore them
parent 78a32a4d
No related branches found
No related tags found
No related merge requests found
...@@ -244,7 +244,10 @@ public function transform($value, MigrateExecutableInterface $migrate_executable ...@@ -244,7 +244,10 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
} }
catch (\LogicException $e) { catch (\LogicException $e) {
// For BC reasons, we must allow attempting to stub a derived migration. // 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) { catch (MigrateException $e) {
throw $e; throw $e;
......
<?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');
}
}
...@@ -2,27 +2,19 @@ ...@@ -2,27 +2,19 @@
namespace Drupal\Tests\path\Kernel\Migrate\d7; namespace Drupal\Tests\path\Kernel\Migrate\d7;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
/** /**
* Tests URL alias migration. * Tests URL alias migration.
* *
* @group path * @group path
*/ */
class MigrateUrlAliasTest extends MigrateDrupal7TestBase { class MigrateUrlAliasTest extends MigrateUrlAliasTestBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public static $modules = [ public static $modules = [
'content_translation', 'content_translation',
'language',
'menu_ui',
// Required for translation migrations.
'migrate_drupal_multilingual', 'migrate_drupal_multilingual',
'node',
'path',
'text',
]; ];
/** /**
...@@ -30,43 +22,12 @@ class MigrateUrlAliasTest extends MigrateDrupal7TestBase { ...@@ -30,43 +22,12 @@ class MigrateUrlAliasTest extends MigrateDrupal7TestBase {
*/ */
protected function setUp() { protected function setUp() {
parent::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([ $this->executeMigrations([
'language',
'd7_node',
'd7_node_translation', 'd7_node_translation',
'd7_url_alias', '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. * Test the URL alias migration with translated nodes.
*/ */
......
<?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']);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment