Issue #3086952 by mikelutz, quietone: Migration Lookup should catch PluginNotFoundException exceptions and ignore them
parent
78a32a4de8
commit
5a7951f29a
|
@ -244,7 +244,10 @@ class MigrationLookup extends ProcessPluginBase implements ContainerFactoryPlugi
|
|||
}
|
||||
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;
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
||||
}
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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']);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue