Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
225
Merge Requests
225
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
0b45cbb7
Commit
0b45cbb7
authored
Mar 03, 2017
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2850984
by maxocub: Fix path alias migration of translated nodes [D7]
parent
0179304d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
86 additions
and
2 deletions
+86
-2
core/modules/migrate_drupal/tests/fixtures/drupal7.php
core/modules/migrate_drupal/tests/fixtures/drupal7.php
+24
-0
core/modules/path/migration_templates/d7_url_alias.yml
core/modules/path/migration_templates/d7_url_alias.yml
+12
-0
core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTest.php
.../path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTest.php
+50
-2
No files found.
core/modules/migrate_drupal/tests/fixtures/drupal7.php
View file @
0b45cbb7
...
@@ -43135,6 +43135,30 @@
...
@@ -43135,6 +43135,30 @@
'alias' => 'term33',
'alias' => 'term33',
'language' => 'und',
'language' => 'und',
))
))
->values(array(
'pid' => '2',
'source' => 'node/2',
'alias' => 'deep-space-9',
'language' => 'en',
))
->values(array(
'pid' => '3',
'source' => 'node/3',
'alias' => 'deep-space-9-is',
'language' => 'is',
))
->values(array(
'pid' => '4',
'source' => 'node/4',
'alias' => 'firefly-is',
'language' => 'is',
))
->values(array(
'pid' => '5',
'source' => 'node/5',
'alias' => 'firefly',
'language' => 'en',
))
->execute();
->execute();
$connection->schema()->createTable('users', array(
$connection->schema()->createTable('users', array(
core/modules/path/migration_templates/d7_url_alias.yml
View file @
0b45cbb7
...
@@ -18,5 +18,17 @@ process:
...
@@ -18,5 +18,17 @@ process:
-
constants/slash
-
constants/slash
-
alias
-
alias
langcode
:
language
langcode
:
language
node_translation
:
-
plugin
:
explode
source
:
source
delimiter
:
/
-
plugin
:
extract
index
:
-
1
-
plugin
:
migration
migration
:
d7_node_translation
destination
:
destination
:
plugin
:
url_alias
plugin
:
url_alias
core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTest.php
View file @
0b45cbb7
...
@@ -14,14 +14,33 @@ class MigrateUrlAliasTest extends MigrateDrupal7TestBase {
...
@@ -14,14 +14,33 @@ class MigrateUrlAliasTest extends MigrateDrupal7TestBase {
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public
static
$modules
=
[
'path'
];
public
static
$modules
=
[
'content_translation'
,
'language'
,
'node'
,
'path'
,
'text'
,
];
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
protected
function
setUp
()
{
protected
function
setUp
()
{
parent
::
setUp
();
parent
::
setUp
();
$this
->
executeMigration
(
'd7_url_alias'
);
$this
->
installEntitySchema
(
'node'
);
$this
->
installConfig
(
'node'
);
$this
->
installSchema
(
'node'
,
[
'node_access'
]);
$this
->
executeMigrations
([
'language'
,
'd7_user_role'
,
'd7_user'
,
'd7_node_type'
,
'd7_node'
,
'd7_node_translation'
,
'd7_url_alias'
,
]);
}
}
/**
/**
...
@@ -38,4 +57,33 @@ public function testUrlAlias() {
...
@@ -38,4 +57,33 @@ public function testUrlAlias() {
$this
->
assertIdentical
(
'und'
,
$path
[
'langcode'
]);
$this
->
assertIdentical
(
'und'
,
$path
[
'langcode'
]);
}
}
/**
* Test the URL alias migration with translated nodes.
*/
public
function
testUrlAliasWithTranslatedNodes
()
{
$alias_storage
=
$this
->
container
->
get
(
'path.alias_storage'
);
// Alias for the 'The thing about Deep Space 9' node in English.
$path
=
$alias_storage
->
load
([
'alias'
=>
'/deep-space-9'
]);
$this
->
assertSame
(
'/node/2'
,
$path
[
'source'
]);
$this
->
assertSame
(
'en'
,
$path
[
'langcode'
]);
// Alias for the 'The thing about Deep Space 9' Icelandic translation,
// which should now point to node/2 instead of node/3.
$path
=
$alias_storage
->
load
([
'alias'
=>
'/deep-space-9-is'
]);
$this
->
assertSame
(
'/node/2'
,
$path
[
'source'
]);
$this
->
assertSame
(
'is'
,
$path
[
'langcode'
]);
// Alias for the 'The thing about Firefly' node in Icelandic.
$path
=
$alias_storage
->
load
([
'alias'
=>
'/firefly-is'
]);
$this
->
assertSame
(
'/node/4'
,
$path
[
'source'
]);
$this
->
assertSame
(
'is'
,
$path
[
'langcode'
]);
// Alias for the 'The thing about Firefly' English translation,
// which should now point to node/4 instead of node/5.
$path
=
$alias_storage
->
load
([
'alias'
=>
'/firefly'
]);
$this
->
assertSame
(
'/node/4'
,
$path
[
'source'
]);
$this
->
assertSame
(
'en'
,
$path
[
'langcode'
]);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment