summaryrefslogtreecommitdiff
path: root/modules/simpletest
diff options
context:
space:
mode:
Diffstat (limited to 'modules/simpletest')
-rw-r--r--modules/simpletest/drupal_web_test_case.php11
-rw-r--r--modules/simpletest/tests/ajax.test10
-rw-r--r--modules/simpletest/tests/common.test7
-rw-r--r--modules/simpletest/tests/database_test.test4
-rw-r--r--modules/simpletest/tests/file.test7
-rw-r--r--modules/simpletest/tests/form.test4
-rw-r--r--modules/simpletest/tests/form_test.module4
-rw-r--r--modules/simpletest/tests/mail.test2
8 files changed, 32 insertions, 17 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index 2c6d9c919..2db22c06b 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -1102,7 +1102,7 @@ class DrupalWebTestCase extends DrupalTestCase {
* List of modules to enable for the duration of the test. This can be
* either a single array or a variable number of string arguments.
*/
- protected function setUp($modules = array()) {
+ protected function setUp() {
global $db_prefix, $user, $language, $conf;
// Store necessary current values before switching to prefixed database.
@@ -1166,8 +1166,9 @@ class DrupalWebTestCase extends DrupalTestCase {
// either a single array argument or a variable number of string arguments.
// @todo Remove this compatibility layer in Drupal 8, and only accept
// $modules as a single array argument.
- if (!is_array($modules)) {
- $modules = func_get_args();
+ $modules = func_get_args();
+ if (isset($modules[0]) && is_array($modules[0])) {
+ $modules = $modules[0];
}
if ($modules) {
module_enable($modules, TRUE);
@@ -1203,6 +1204,7 @@ class DrupalWebTestCase extends DrupalTestCase {
variable_set('install_task', 'done');
variable_set('clean_url', $clean_url_original);
variable_set('site_mail', 'simpletest@example.com');
+ variable_set('date_default_timezone', date_default_timezone_get());
// Set up English language.
unset($GLOBALS['conf']['language_default']);
$language = language_default();
@@ -1742,7 +1744,8 @@ class DrupalWebTestCase extends DrupalTestCase {
$wrapperNode = $xpath->query('//*[@id="' . $ajax_settings['wrapper'] . '"]')->item(0);
if ($wrapperNode) {
// ajax.js adds an enclosing DIV to work around a Safari bug.
- $newDom = DOMDocument::loadHTML('<div>' . $command['data'] . '</div>');
+ $newDom = new DOMDocument();
+ $newDom->loadHTML('<div>' . $command['data'] . '</div>');
$newNode = $dom->importNode($newDom->documentElement->firstChild->firstChild, TRUE);
$method = isset($command['method']) ? $command['method'] : $ajax_settings['method'];
// The "method" is a jQuery DOM manipulation function. Emulate each
diff --git a/modules/simpletest/tests/ajax.test b/modules/simpletest/tests/ajax.test
index f6e2e28de..c10b8362b 100644
--- a/modules/simpletest/tests/ajax.test
+++ b/modules/simpletest/tests/ajax.test
@@ -2,7 +2,11 @@
// $Id$
class AJAXTestCase extends DrupalWebTestCase {
- function setUp($modules = array()) {
+ function setUp() {
+ $modules = func_get_args();
+ if (isset($modules[0]) && is_array($modules[0])) {
+ $modules = $modules[0];
+ }
parent::setUp(array_unique(array_merge(array('ajax_test', 'ajax_forms_test'), $modules)));
}
@@ -26,7 +30,7 @@ class AJAXTestCase extends DrupalWebTestCase {
* Tests primary AJAX framework functions.
*/
class AJAXFrameworkTestCase extends AJAXTestCase {
- function getInfo() {
+ public static function getInfo() {
return array(
'name' => 'AJAX framework',
'description' => 'Performs tests on AJAX framework functions.',
@@ -66,7 +70,7 @@ class AJAXFrameworkTestCase extends AJAXTestCase {
* Tests AJAX framework commands.
*/
class AJAXCommandsTestCase extends AJAXTestCase {
- function getInfo() {
+ public static function getInfo() {
return array(
'name' => 'AJAX commands',
'description' => 'Performs tests on AJAX framework commands.',
diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test
index c6d0d6369..9eaefe168 100644
--- a/modules/simpletest/tests/common.test
+++ b/modules/simpletest/tests/common.test
@@ -323,7 +323,8 @@ class CommonXssUnitTest extends DrupalUnitTestCase {
* Check that invalid multi-byte sequences are rejected.
*/
function testInvalidMultiByte() {
- $text = check_plain("Foo\xC0barbaz");
+ // Ignore PHP 5.3+ invalid multibyte sequence warning.
+ $text = @check_plain("Foo\xC0barbaz");
$this->assertEqual($text, '', 'check_plain() rejects invalid sequence "Foo\xC0barbaz"');
$text = check_plain("Fooÿñ");
$this->assertEqual($text, "Fooÿñ", 'check_plain() accepts valid sequence "Fooÿñ"');
@@ -1774,6 +1775,8 @@ class FormatDateUnitTest extends DrupalWebTestCase {
$user = user_load($test_user->uid, TRUE);
$real_language = $language->language;
$language->language = $user->language;
+ // Simulate a Drupal bootstrap with the logged-in user.
+ date_default_timezone_set(drupal_get_user_timezone());
$this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'America/Los_Angeles', 'en'), 'Sunday, 25-Mar-07 17:00:00 PDT', t('Test a different language.'));
$this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'Europe/London'), 'Monday, 26-Mar-07 01:00:00 BST', t('Test a different time zone.'));
@@ -1786,6 +1789,8 @@ class FormatDateUnitTest extends DrupalWebTestCase {
// Restore the original user and language, and enable session saving.
$user = $real_user;
$language->language = $real_language;
+ // Restore default time zone.
+ date_default_timezone_set(drupal_get_user_timezone());
drupal_save_session(TRUE);
}
}
diff --git a/modules/simpletest/tests/database_test.test b/modules/simpletest/tests/database_test.test
index 95ebc1ca5..59080c713 100644
--- a/modules/simpletest/tests/database_test.test
+++ b/modules/simpletest/tests/database_test.test
@@ -3160,7 +3160,7 @@ class DatabaseExtraTypesTestCase extends DrupalWebTestCase {
* Check the sequences API.
*/
class DatabaseNextIdCase extends DrupalWebTestCase {
- function getInfo() {
+ public static function getInfo() {
return array(
'name' => t('Sequences API'),
'description' => t('Test the secondary sequences API.'),
@@ -3187,7 +3187,7 @@ class DatabaseNextIdCase extends DrupalWebTestCase {
* Tests the empty pseudo-statement class.
*/
class DatabaseEmptyStatementTestCase extends DrupalWebTestCase {
- function getInfo() {
+ public static function getInfo() {
return array(
'name' => t('Empty statement'),
'description' => t('Test the empty pseudo-statement class.'),
diff --git a/modules/simpletest/tests/file.test b/modules/simpletest/tests/file.test
index abd1c2cbf..939430d72 100644
--- a/modules/simpletest/tests/file.test
+++ b/modules/simpletest/tests/file.test
@@ -1946,10 +1946,13 @@ class FileDownloadTest extends FileTestCase {
function testFileCreateUrl() {
global $base_url;
- $basename = " -._~!$'\"()*@[]?&+%#,;=:\n\x00" . // "Special" ASCII characters.
+ // Tilde (~) is excluded from this test because it is encoded by
+ // rawurlencode() in PHP 5.2 but not in PHP 5.3, as per RFC 3986.
+ // @see http://www.php.net/manual/en/function.rawurlencode.php#86506
+ $basename = " -._!$'\"()*@[]?&+%#,;=:\n\x00" . // "Special" ASCII characters.
"%23%25%26%2B%2F%3F" . // Characters that look like a percent-escaped string.
"éøïвβ中國書۞"; // Characters from various non-ASCII alphabets.
- $basename_encoded = '%20-._%7E%21%24%27%22%28%29%2A%40%5B%5D%3F%26%2B%25%23%2C%3B%3D%3A__' .
+ $basename_encoded = '%20-._%21%24%27%22%28%29%2A%40%5B%5D%3F%26%2B%25%23%2C%3B%3D%3A__' .
'%2523%2525%2526%252B%252F%253F' .
'%C3%A9%C3%B8%C3%AF%D0%B2%CE%B2%E4%B8%AD%E5%9C%8B%E6%9B%B8%DB%9E';
diff --git a/modules/simpletest/tests/form.test b/modules/simpletest/tests/form.test
index c5639be87..87374dd00 100644
--- a/modules/simpletest/tests/form.test
+++ b/modules/simpletest/tests/form.test
@@ -843,7 +843,7 @@ class FormsRebuildTestCase extends DrupalWebTestCase {
*/
class FormsProgrammaticTestCase extends DrupalWebTestCase {
- function getInfo() {
+ public static function getInfo() {
return array(
'name' => 'Programmatic form submissions',
'description' => 'Test the programmatic form submission behavior.',
@@ -908,7 +908,7 @@ class FormsProgrammaticTestCase extends DrupalWebTestCase {
*/
class FormsClickedButtonTestCase extends DrupalWebTestCase {
- function getInfo() {
+ public static function getInfo() {
return array(
'name' => 'Form clicked button determination',
'description' => 'Test the determination of $form_state[\'clicked_button\'].',
diff --git a/modules/simpletest/tests/form_test.module b/modules/simpletest/tests/form_test.module
index d189fe56b..11a76534e 100644
--- a/modules/simpletest/tests/form_test.module
+++ b/modules/simpletest/tests/form_test.module
@@ -508,10 +508,10 @@ function form_test_storage_form_submit($form, &$form_state) {
$form_state['redirect'] = 'node';
}
- /**
+/**
* A form for testing form labels and required marks.
*/
-function form_label_test_form(&$form_state) {
+function form_label_test_form() {
$form['form_checkboxes_test'] = array(
'#type' => 'checkboxes',
'#title' => t('Checkboxes test'),
diff --git a/modules/simpletest/tests/mail.test b/modules/simpletest/tests/mail.test
index 5db3abb7e..48b61c3c7 100644
--- a/modules/simpletest/tests/mail.test
+++ b/modules/simpletest/tests/mail.test
@@ -13,7 +13,7 @@ class MailTestCase extends DrupalWebTestCase implements MailSystemInterface {
*/
private static $sent_message;
- function getInfo() {
+ public static function getInfo() {
return array(
'name' => 'Mail system',
'description' => 'Performs tests on the pluggable mailing framework.',