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
f1c7eec6
Commit
f1c7eec6
authored
Oct 01, 2012
by
Jennifer Hodgdon
Browse files
Issue
#1797120
by Lars Toomre: Remove a couple more t() uses from system tests A-C
parent
162314d7
Changes
8
Hide whitespace changes
Inline
Side-by-side
core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php
View file @
f1c7eec6
...
...
@@ -153,7 +153,7 @@ function testPageCompression() {
$this
->
drupalGet
(
''
);
$this
->
assertEqual
(
$this
->
drupalGetHeader
(
'X-Drupal-Cache'
),
'HIT'
,
'Page was cached.'
);
$this
->
assertFalse
(
$this
->
drupalGetHeader
(
'Content-Encoding'
),
'A Content-Encoding header was not sent.'
);
$this
->
assertTitle
(
t
(
'Welcome to @site-name | @site-name'
,
array
(
'@site-name'
=>
config
(
'system.site'
)
->
get
(
'name'
))),
t
(
'Site title matches.'
)
)
;
$this
->
assertTitle
(
t
(
'Welcome to @site-name | @site-name'
,
array
(
'@site-name'
=>
config
(
'system.site'
)
->
get
(
'name'
))),
'Site title matches.'
);
$this
->
assertRaw
(
'</html>'
,
'Page was not compressed.'
);
}
}
core/modules/system/lib/Drupal/system/Tests/Bootstrap/ResettableStaticUnitTest.php
View file @
f1c7eec6
...
...
@@ -29,7 +29,7 @@ public static function getInfo() {
function
testDrupalStatic
()
{
$name
=
__CLASS__
.
'_'
.
__METHOD__
;
$var
=
&
drupal_static
(
$name
,
'foo'
);
$this
->
assertEqual
(
$var
,
'foo'
,
t
(
'Variable returned by drupal_static() was set to its default.'
)
)
;
$this
->
assertEqual
(
$var
,
'foo'
,
'Variable returned by drupal_static() was set to its default.'
);
// Call the specific reset and the global reset each twice to ensure that
// multiple resets can be issued without odd side effects.
...
...
core/modules/system/lib/Drupal/system/Tests/Common/HtmlIdentifierUnitTest.php
View file @
f1c7eec6
...
...
@@ -42,7 +42,7 @@ function testDrupalCleanCSSIdentifier() {
*/
function
testDrupalHTMLClass
()
{
// Verify Drupal coding standards are enforced.
$this
->
assertIdentical
(
drupal_html_class
(
'CLASS NAME_[Ü]'
),
'class-name--ü'
,
t
(
'Enforce Drupal coding standards.'
)
)
;
$this
->
assertIdentical
(
drupal_html_class
(
'CLASS NAME_[Ü]'
),
'class-name--ü'
,
'Enforce Drupal coding standards.'
);
}
/**
...
...
core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php
View file @
f1c7eec6
...
...
@@ -195,7 +195,7 @@ function testAddInline() {
drupal_add_library
(
'system'
,
'drupal'
);
$inline
=
'jQuery(function () { });'
;
$javascript
=
drupal_add_js
(
$inline
,
array
(
'type'
=>
'inline'
,
'scope'
=>
'footer'
));
$this
->
assertTrue
(
array_key_exists
(
'core/misc/jquery.js'
,
$javascript
),
t
(
'jQuery is added when inline scripts are added.'
)
)
;
$this
->
assertTrue
(
array_key_exists
(
'core/misc/jquery.js'
,
$javascript
),
'jQuery is added when inline scripts are added.'
);
$data
=
end
(
$javascript
);
$this
->
assertEqual
(
$inline
,
$data
[
'data'
],
'Inline JavaScript is correctly added to the footer.'
);
}
...
...
@@ -445,7 +445,7 @@ function testAlter() {
*/
function
testLibraryRender
()
{
$result
=
drupal_add_library
(
'system'
,
'jquery.farbtastic'
);
$this
->
assertTrue
(
$result
!==
FALSE
,
t
(
'Library was added without errors.'
)
)
;
$this
->
assertTrue
(
$result
!==
FALSE
,
'Library was added without errors.'
);
$scripts
=
drupal_get_js
();
$styles
=
drupal_get_css
();
$this
->
assertTrue
(
strpos
(
$scripts
,
'core/misc/farbtastic/farbtastic.js'
),
'JavaScript of library was added to the page.'
);
...
...
@@ -460,7 +460,7 @@ function testLibraryRender() {
function
testLibraryAlter
()
{
// Verify that common_test altered the title of Farbtastic.
$library
=
drupal_get_library
(
'system'
,
'jquery.farbtastic'
);
$this
->
assertEqual
(
$library
[
'title'
],
'Farbtastic: Altered Library'
,
t
(
'Registered libraries were altered.'
)
)
;
$this
->
assertEqual
(
$library
[
'title'
],
'Farbtastic: Altered Library'
,
'Registered libraries were altered.'
);
// common_test_library_info_alter() also added a dependency on jQuery Form.
drupal_add_library
(
'system'
,
'jquery.farbtastic'
);
...
...
@@ -483,11 +483,11 @@ function testLibraryNameConflicts() {
*/
function
testLibraryUnknown
()
{
$result
=
drupal_get_library
(
'unknown'
,
'unknown'
);
$this
->
assertFalse
(
$result
,
t
(
'Unknown library returned FALSE.'
)
)
;
$this
->
assertFalse
(
$result
,
'Unknown library returned FALSE.'
);
drupal_static_reset
(
'drupal_get_library'
);
$result
=
drupal_add_library
(
'unknown'
,
'unknown'
);
$this
->
assertFalse
(
$result
,
t
(
'Unknown library returned FALSE.'
)
)
;
$this
->
assertFalse
(
$result
,
'Unknown library returned FALSE.'
);
$scripts
=
drupal_get_js
();
$this
->
assertTrue
(
strpos
(
$scripts
,
'unknown'
)
===
FALSE
,
'Unknown library was not added to the page.'
);
}
...
...
core/modules/system/lib/Drupal/system/Tests/Common/JsonUnitTest.php
View file @
f1c7eec6
...
...
@@ -48,7 +48,7 @@ function testJSON() {
$this
->
assertTrue
(
strlen
(
$json
)
>
strlen
(
$str
),
'A JSON encoded string is larger than the source string.'
);
// The first and last characters should be ", and no others.
$this
->
assertTrue
(
$json
[
0
]
==
'"'
,
t
(
'A JSON encoded string begins with ".'
)
)
;
$this
->
assertTrue
(
$json
[
0
]
==
'"'
,
'A JSON encoded string begins with ".'
);
$this
->
assertTrue
(
$json
[
strlen
(
$json
)
-
1
]
==
'"'
,
'A JSON encoded string ends with ".'
);
$this
->
assertTrue
(
substr_count
(
$json
,
'"'
)
==
2
,
'A JSON encoded string contains exactly two ".'
);
...
...
core/modules/system/lib/Drupal/system/Tests/Common/ParseInfoFileUnitTest.php
View file @
f1c7eec6
...
...
@@ -26,8 +26,8 @@ public static function getInfo() {
*/
function
testParseInfoFile
()
{
$info_values
=
drupal_parse_info_file
(
drupal_get_path
(
'module'
,
'system'
)
.
'/tests/common_test_info.txt'
);
$this
->
assertEqual
(
$info_values
[
'simple_string'
],
'A simple string'
,
t
(
'Simple string value was parsed correctly.'
)
,
'System'
);
$this
->
assertEqual
(
$info_values
[
'simple_constant'
],
WATCHDOG_INFO
,
t
(
'Constant value was parsed correctly.'
)
,
'System'
);
$this
->
assertEqual
(
$info_values
[
'double_colon'
],
'dummyClassName::'
,
t
(
'Value containing double-colon was parsed correctly.'
)
,
'System'
);
$this
->
assertEqual
(
$info_values
[
'simple_string'
],
'A simple string'
,
'Simple string value was parsed correctly.'
,
'System'
);
$this
->
assertEqual
(
$info_values
[
'simple_constant'
],
WATCHDOG_INFO
,
'Constant value was parsed correctly.'
,
'System'
);
$this
->
assertEqual
(
$info_values
[
'double_colon'
],
'dummyClassName::'
,
'Value containing double-colon was parsed correctly.'
,
'System'
);
}
}
core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php
View file @
f1c7eec6
...
...
@@ -295,7 +295,7 @@ protected function assertRenderedElement(array $element, $xpath, array $xpath_ar
// @see Drupal\simpletest\WebTestBase::xpath()
$xpath
=
$this
->
buildXPathQuery
(
$xpath
,
$xpath_args
);
$element
+=
array
(
'#value'
=>
NULL
);
$this
->
assertFieldByXPath
(
$xpath
,
$element
[
'#value'
],
t
(
'#type @type was properly rendered.'
,
array
(
$this
->
assertFieldByXPath
(
$xpath
,
$element
[
'#value'
],
format_string
(
'#type @type was properly rendered.'
,
array
(
'@type'
=>
var_export
(
$element
[
'#type'
],
TRUE
),
)));
}
...
...
core/modules/system/lib/Drupal/system/Tests/Common/SimpleTestErrorCollectorTest.php
View file @
f1c7eec6
...
...
@@ -45,7 +45,7 @@ public static function getInfo() {
function
testErrorCollect
()
{
$this
->
collectedErrors
=
array
();
$this
->
drupalGet
(
'error-test/generate-warnings-with-report'
);
$this
->
assertEqual
(
count
(
$this
->
collectedErrors
),
3
,
t
(
'Three errors were collected'
)
)
;
$this
->
assertEqual
(
count
(
$this
->
collectedErrors
),
3
,
'Three errors were collected'
);
if
(
count
(
$this
->
collectedErrors
)
==
3
)
{
$this
->
assertError
(
$this
->
collectedErrors
[
0
],
'Notice'
,
'error_test_generate_warnings()'
,
'error_test.module'
,
'Undefined variable: bananas'
);
...
...
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