Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
969e670e
Commit
969e670e
authored
May 14, 2012
by
Nathaniel Catchpole
Browse files
Issue
#1546752
by Gábor Hojtsy, erno, xjm: Move negotiation tests to language module.
parent
9e2223c5
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
core/modules/language/language.test
View file @
969e670e
This diff is collapsed.
Click to expand it.
core/modules/l
ocal
e/tests/l
ocal
e_test.info
→
core/modules/l
anguag
e/tests/l
anguag
e_test.info
View file @
969e670e
name
=
"L
ocal
e
T
est"
description
=
"Support module for the l
ocal
e layer tests."
name
=
"L
anguag
e
t
est"
description
=
"Support module for the l
anguag
e layer tests."
core
=
8.
x
package
=
Testing
version
=
VERSION
...
...
core/modules/l
ocal
e/tests/l
ocal
e_test.module
→
core/modules/l
anguag
e/tests/l
anguag
e_test.module
View file @
969e670e
...
...
@@ -2,7 +2,7 @@
/**
* @file
* Mock module for l
ocal
e layer tests.
* Mock module for l
anguag
e layer tests.
*/
/**
...
...
@@ -11,17 +11,17 @@
* For testing domain language negotiation, we fake it by setting
* the HTTP_HOST here
*/
function
l
ocal
e_test_boot
()
{
if
(
variable_get
(
'l
ocal
e_test_domain'
))
{
$_SERVER
[
'HTTP_HOST'
]
=
variable_get
(
'l
ocal
e_test_domain'
);
function
l
anguag
e_test_boot
()
{
if
(
variable_get
(
'l
anguag
e_test_domain'
))
{
$_SERVER
[
'HTTP_HOST'
]
=
variable_get
(
'l
anguag
e_test_domain'
);
}
}
/**
* Implements hook_init().
*/
function
l
ocal
e_test_init
()
{
l
ocal
e_test_store_language_negotiation
();
function
l
anguag
e_test_init
()
{
l
anguag
e_test_store_language_negotiation
();
if
(
isset
(
drupal_container
()
->
get
(
LANGUAGE_TYPE_INTERFACE
)
->
langcode
)
&&
isset
(
drupal_container
()
->
get
(
LANGUAGE_TYPE_INTERFACE
)
->
method_id
))
{
drupal_set_message
(
t
(
'Language negotiation method: @name'
,
array
(
'@name'
=>
drupal_container
()
->
get
(
LANGUAGE_TYPE_INTERFACE
)
->
method_id
)));
}
...
...
@@ -30,8 +30,8 @@ function locale_test_init() {
/**
* Implements hook_language_types_info().
*/
function
l
ocal
e_test_language_types_info
()
{
if
(
variable_get
(
'l
ocal
e_test_language_types'
,
FALSE
))
{
function
l
anguag
e_test_language_types_info
()
{
if
(
variable_get
(
'l
anguag
e_test_language_types'
,
FALSE
))
{
return
array
(
'test_language_type'
=>
array
(
'name'
=>
t
(
'Test'
),
...
...
@@ -47,8 +47,8 @@ function locale_test_language_types_info() {
/**
* Implements hook_language_types_info_alter().
*/
function
l
ocal
e_test_language_types_info_alter
(
array
&
$language_types
)
{
if
(
variable_get
(
'l
ocal
e_test_content_language_type'
,
FALSE
))
{
function
l
anguag
e_test_language_types_info_alter
(
array
&
$language_types
)
{
if
(
variable_get
(
'l
anguag
e_test_content_language_type'
,
FALSE
))
{
unset
(
$language_types
[
LANGUAGE_TYPE_CONTENT
][
'fixed'
]);
}
}
...
...
@@ -56,13 +56,13 @@ function locale_test_language_types_info_alter(array &$language_types) {
/**
* Implements hook_language_negotiation_info().
*/
function
l
ocal
e_test_language_negotiation_info
()
{
if
(
variable_get
(
'l
ocal
e_test_language_negotiation_info'
,
FALSE
))
{
function
l
anguag
e_test_language_negotiation_info
()
{
if
(
variable_get
(
'l
anguag
e_test_language_negotiation_info'
,
FALSE
))
{
$info
=
array
(
'callbacks'
=>
array
(
'negotiation'
=>
'l
ocal
e_test_language_negotiation_method'
,
'negotiation'
=>
'l
anguag
e_test_language_negotiation_method'
,
),
'file'
=>
drupal_get_path
(
'module'
,
'l
ocal
e_test'
)
.
'/l
ocal
e_test.module'
,
'file'
=>
drupal_get_path
(
'module'
,
'l
anguag
e_test'
)
.
'/l
anguag
e_test.module'
,
'weight'
=>
-
10
,
'description'
=>
t
(
'This is a test language negotiation method.'
),
);
...
...
@@ -83,8 +83,8 @@ function locale_test_language_negotiation_info() {
/**
* Implements hook_language_negotiation_info_alter().
*/
function
l
ocal
e_test_language_negotiation_info_alter
(
array
&
$negotiation_info
)
{
if
(
variable_get
(
'l
ocal
e_test_language_negotiation_info_alter'
,
FALSE
))
{
function
l
anguag
e_test_language_negotiation_info_alter
(
array
&
$negotiation_info
)
{
if
(
variable_get
(
'l
anguag
e_test_language_negotiation_info_alter'
,
FALSE
))
{
unset
(
$negotiation_info
[
LANGUAGE_NEGOTIATION_INTERFACE
]);
}
}
...
...
@@ -92,17 +92,17 @@ function locale_test_language_negotiation_info_alter(array &$negotiation_info) {
/**
* Store the last negotiated languages.
*/
function
l
ocal
e_test_store_language_negotiation
()
{
function
l
anguag
e_test_store_language_negotiation
()
{
$last
=
array
();
foreach
(
language_types_get_all
()
as
$type
)
{
$last
[
$type
]
=
$GLOBALS
[
$type
]
->
langcode
;
}
variable_set
(
'l
ocal
e_test_language_negotiation_last'
,
$last
);
variable_set
(
'l
anguag
e_test_language_negotiation_last'
,
$last
);
}
/**
* Provides a test language negotiation method.
*/
function
l
ocal
e_test_language_negotiation_method
(
$languages
)
{
function
l
anguag
e_test_language_negotiation_method
(
$languages
)
{
return
'it'
;
}
core/modules/locale/locale.test
View file @
969e670e
This diff is collapsed.
Click to expand it.
core/modules/path/path.test
View file @
969e670e
...
...
@@ -517,63 +517,3 @@ class PathLanguageUITestCase extends PathTestCase {
}
}
/**
* Tests that paths are not prefixed on a monolingual site.
*/
class
PathMonolingualTestCase
extends
PathTestCase
{
public
static
function
getInfo
()
{
return
array
(
'name'
=>
'Paths on non-English monolingual sites'
,
'description'
=>
'Confirm that paths are not changed on monolingual non-English sites'
,
'group'
=>
'Path'
,
);
}
function
setUp
()
{
parent
::
setUp
(
'path'
,
'locale'
,
'translation'
);
// Create and login user.
$web_user
=
$this
->
drupalCreateUser
(
array
(
'administer languages'
,
'access administration pages'
));
$this
->
drupalLogin
(
$web_user
);
// Enable French language.
$edit
=
array
();
$edit
[
'predefined_langcode'
]
=
'fr'
;
$this
->
drupalPost
(
'admin/config/regional/language/add'
,
$edit
,
t
(
'Add language'
));
// Make French the default language.
$edit
=
array
(
'site_default'
=>
'fr'
);
$this
->
drupalPost
(
'admin/config/regional/language'
,
$edit
,
t
(
'Save configuration'
));
// Delete English.
$this
->
drupalPost
(
'admin/config/regional/language/delete/en'
,
array
(),
t
(
'Delete'
));
// Verify that French is the only language.
$this
->
assertFalse
(
language_multilingual
(),
t
(
'Site is mono-lingual'
));
$this
->
assertEqual
(
language_default
()
->
langcode
,
'fr'
,
t
(
'French is the default language'
));
// Set language detection to URL.
$edit
=
array
(
'language_interface[enabled][language-url]'
=>
TRUE
);
$this
->
drupalPost
(
'admin/config/regional/language/detection'
,
$edit
,
t
(
'Save settings'
));
// Force languages to be initialized.
drupal_language_initialize
();
}
/**
* Verifies that links do not have language prefixes in them.
*/
function
testPageLinks
()
{
// Navigate to 'admin/config' path.
$this
->
drupalGet
(
'admin/config'
);
// Verify that links in this page do not have a 'fr/' prefix.
$this
->
assertNoLinkByHref
(
'/fr/'
,
'Links do not contain language prefix'
);
// Verify that links in this page can be followed and work.
$this
->
clickLink
(
t
(
'Languages'
));
$this
->
assertResponse
(
200
,
'Clicked link results in a valid page'
);
$this
->
assertText
(
t
(
'Add language'
),
'Page contains the add language text'
);
}
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment