Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
463d8440
Commit
463d8440
authored
Mar 31, 2016
by
catch
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2614824
by alexpott, xjm, catch: Tests fail when version constant is stable
parent
47febbf6
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/node/src/Tests/NodeTypeTranslationTest.php
+17
-7
17 additions, 7 deletions
core/modules/node/src/Tests/NodeTypeTranslationTest.php
with
17 additions
and
7 deletions
core/modules/node/src/Tests/NodeTypeTranslationTest.php
+
17
−
7
View file @
463d8440
...
@@ -14,6 +14,10 @@
...
@@ -14,6 +14,10 @@
/**
/**
* Ensures that node types translation work correctly.
* Ensures that node types translation work correctly.
*
*
* Note that the child site is installed in French; therefore, when making
* assertions on translated text it is important to provide a langcode. This
* ensures the asserts pass regardless of the Drupal version.
*
* @group node
* @group node
*/
*/
class
NodeTypeTranslationTest
extends
WebTestBase
{
class
NodeTypeTranslationTest
extends
WebTestBase
{
...
@@ -105,12 +109,16 @@ public function testNodeTypeTranslation() {
...
@@ -105,12 +109,16 @@ public function testNodeTypeTranslation() {
// Check the name is translated without admin theme for editing.
// Check the name is translated without admin theme for editing.
$this
->
drupalPostForm
(
'admin/appearance'
,
array
(
'use_admin_theme'
=>
'0'
),
t
(
'Save configuration'
));
$this
->
drupalPostForm
(
'admin/appearance'
,
array
(
'use_admin_theme'
=>
'0'
),
t
(
'Save configuration'
));
$this
->
drupalGet
(
"
$langcode
/node/add/
$type
"
);
$this
->
drupalGet
(
"
$langcode
/node/add/
$type
"
);
$this
->
assertRaw
(
t
(
'Create @name'
,
array
(
'@name'
=>
$translated_name
)));
// This is a Spanish page, so ensure the text asserted is translated in
// Spanish and not French by adding the langcode option.
$this
->
assertRaw
(
t
(
'Create @name'
,
array
(
'@name'
=>
$translated_name
),
array
(
'langcode'
=>
$langcode
)));
// Check the name is translated with admin theme for editing.
// Check the name is translated with admin theme for editing.
$this
->
drupalPostForm
(
'admin/appearance'
,
array
(
'use_admin_theme'
=>
'1'
),
t
(
'Save configuration'
));
$this
->
drupalPostForm
(
'admin/appearance'
,
array
(
'use_admin_theme'
=>
'1'
),
t
(
'Save configuration'
));
$this
->
drupalGet
(
"
$langcode
/node/add/
$type
"
);
$this
->
drupalGet
(
"
$langcode
/node/add/
$type
"
);
$this
->
assertRaw
(
t
(
'Create @name'
,
array
(
'@name'
=>
$translated_name
)));
// This is a Spanish page, so ensure the text asserted is translated in
// Spanish and not French by adding the langcode option.
$this
->
assertRaw
(
t
(
'Create @name'
,
array
(
'@name'
=>
$translated_name
),
array
(
'langcode'
=>
$langcode
)));
}
}
/**
/**
...
@@ -128,17 +136,19 @@ public function testNodeTypeTitleLabelTranslation() {
...
@@ -128,17 +136,19 @@ public function testNodeTypeTitleLabelTranslation() {
// Assert that the title label is displayed on the translation form with the right value.
// Assert that the title label is displayed on the translation form with the right value.
$this
->
drupalGet
(
"admin/structure/types/manage/
$type
/translate/
$langcode
/add"
);
$this
->
drupalGet
(
"admin/structure/types/manage/
$type
/translate/
$langcode
/add"
);
$this
->
assertRaw
(
t
(
'Label'
));
$this
->
assertText
(
'Edited title'
);
$this
->
assertRaw
(
t
(
'Edited title'
));
// Translate the title label.
// Translate the title label.
$this
->
drupalPostForm
(
NULL
,
array
(
"translation[config_names][core.base_field_override.node.
$type
.title][label]"
=>
'Translated title'
),
t
(
'Save translation'
));
$this
->
drupalPostForm
(
NULL
,
array
(
"translation[config_names][core.base_field_override.node.
$type
.title][label]"
=>
'Translated title'
),
t
(
'Save translation'
));
// Assert that the right title label is displayed on the node add form.
// Assert that the right title label is displayed on the node add form. The
// translations are created in this test; therefore, the assertions do not
// use t(). If t() were used then the correct langcodes would need to be
// provided.
$this
->
drupalGet
(
"node/add/
$type
"
);
$this
->
drupalGet
(
"node/add/
$type
"
);
$this
->
assert
Raw
(
t
(
'Edited title'
)
)
;
$this
->
assert
Tex
t
(
'Edited title'
);
$this
->
drupalGet
(
"
$langcode
/node/add/
$type
"
);
$this
->
drupalGet
(
"
$langcode
/node/add/
$type
"
);
$this
->
assert
Raw
(
t
(
'Translated title'
)
)
;
$this
->
assert
Tex
t
(
'Translated title'
);
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment