Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
drupal
Commits
6e0b06ce
Commit
6e0b06ce
authored
Nov 22, 2008
by
Dries
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Patch
#324319
by catch: cleaned up the translation tests a bit.
parent
151ed277
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
modules/translation/translation.test
modules/translation/translation.test
+14
-10
No files found.
modules/translation/translation.test
View file @
6e0b06ce
...
...
@@ -38,23 +38,27 @@ class TranslationTestCase extends DrupalWebTestCase {
// Set page content type to use multilingual support with translation.
$this
->
drupalGet
(
'admin/build/node-type/page'
);
$this
->
drupalPost
(
'admin/build/node-type/page'
,
array
(
'language_content_type'
=>
'2'
),
t
(
'Save content type'
));
$edit
=
array
();
$edit
[
'language_content_type'
]
=
2
;
$this
->
drupalPost
(
'admin/build/node-type/page'
,
$edit
,
t
(
'Save content type'
));
$this
->
assertRaw
(
t
(
'The content type %type has been updated.'
,
array
(
'%type'
=>
'Page'
)),
t
(
'Page content type has been updated.'
));
$this
->
drupalLogout
();
$this
->
drupalLogin
(
$translator
);
// Create page in English.
$node_title
=
'Test Translation '
.
$this
->
randomName
();
$node
=
$this
->
createPage
(
$node_title
,
'Node body.'
,
'en'
);
$node_title
=
$this
->
randomName
();
$node_body
=
$this
->
randomName
();
$node
=
$this
->
createPage
(
$node_title
,
$node_body
,
'en'
);
// Submit translation in Spanish.
$node_trans_title
=
'Test Traduccion '
.
$this
->
randomName
();
$node_trans
=
$this
->
createTranslation
(
$node
->
nid
,
$node_trans_title
,
'Nodo cuerpo.'
,
'es'
);
$node_translation_title
=
$this
->
randomName
();
$node_translation_body
=
$this
->
randomName
();
$node_translation
=
$this
->
createTranslation
(
$node
->
nid
,
$node_translation_title
,
$node_translation_body
,
'es'
);
// Update origninal and mark translation as outdated.
$edit
=
array
();
$edit
[
'body'
]
=
'Node body. Additional Text.'
;
$edit
[
'body'
]
=
$this
->
randomName
()
;
$edit
[
'translation[retranslate]'
]
=
TRUE
;
$this
->
drupalPost
(
'node/'
.
$node
->
nid
.
'/edit'
,
$edit
,
t
(
'Save'
));
$this
->
assertRaw
(
t
(
'Page %title has been updated.'
,
array
(
'%title'
=>
$node_title
)),
t
(
'Original node updated.'
));
...
...
@@ -65,10 +69,10 @@ class TranslationTestCase extends DrupalWebTestCase {
// Update translation and mark as updated.
$edit
=
array
();
$edit
[
'body'
]
=
'Nodo cuerpo. Texto adicional.'
;
$edit
[
'body'
]
=
$this
->
randomName
()
;
$edit
[
'translation[status]'
]
=
FALSE
;
$this
->
drupalPost
(
'node/'
.
$node_trans
->
nid
.
'/edit'
,
$edit
,
t
(
'Save'
));
$this
->
assertRaw
(
t
(
'Page %title has been updated.'
,
array
(
'%title'
=>
$node_trans_title
)),
t
(
'Translated node updated.'
));
$this
->
drupalPost
(
'node/'
.
$node_trans
lation
->
nid
.
'/edit'
,
$edit
,
t
(
'Save'
));
$this
->
assertRaw
(
t
(
'Page %title has been updated.'
,
array
(
'%title'
=>
$node_trans
lation
_title
)),
t
(
'Translated node updated.'
));
}
/**
...
...
@@ -87,7 +91,7 @@ class TranslationTestCase extends DrupalWebTestCase {
$edit
[
'langcode'
]
=
$language_code
;
$this
->
drupalPost
(
'admin/settings/language/add'
,
$edit
,
t
(
'Add language'
));
$languages
=
language_list
(
'language'
,
TRUE
);
//
m
ake sure not using
cached version
$languages
=
language_list
(
'language'
,
TRUE
);
//
M
ake sure
we're
not using
a stale list.
$this
->
assertTrue
(
array_key_exists
(
$language_code
,
$languages
),
t
(
'Language was installed successfully.'
));
if
(
array_key_exists
(
$language_code
,
$languages
))
{
...
...
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