diff options
Diffstat (limited to 'modules/simpletest')
-rw-r--r-- | modules/simpletest/drupal_web_test_case.php | 8 | ||||
-rw-r--r-- | modules/simpletest/simpletest.module | 3 | ||||
-rw-r--r-- | modules/simpletest/tests/batch.test | 4 | ||||
-rw-r--r-- | modules/simpletest/tests/image.test | 6 | ||||
-rw-r--r-- | modules/simpletest/tests/module.test | 4 | ||||
-rw-r--r-- | modules/simpletest/tests/registry.test | 42 | ||||
-rw-r--r-- | modules/simpletest/tests/xmlrpc.test | 6 |
7 files changed, 16 insertions, 57 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index c23081467..8ef61367a 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -519,7 +519,7 @@ abstract class DrupalTestCase { * * These tests can not access the database nor files. Calling any Drupal * function that needs the database will throw exceptions. These include - * watchdog(), drupal_function_exists(), module_implements(), + * watchdog(), function_exists(), module_implements(), * module_invoke_all() etc. */ class DrupalUnitTestCase extends DrupalTestCase { @@ -549,7 +549,7 @@ class DrupalUnitTestCase extends DrupalTestCase { if (isset($module_list['locale'])) { $this->originalModuleList = $module_list; unset($module_list['locale']); - module_list(TRUE, FALSE, $module_list); + module_list(TRUE, FALSE, FALSE, $module_list); } } @@ -561,7 +561,7 @@ class DrupalUnitTestCase extends DrupalTestCase { $db_prefix = $this->originalPrefix; // Restore modules if necessary. if (isset($this->originalModuleList)) { - module_list(TRUE, FALSE, $this->originalModuleList); + module_list(TRUE, FALSE, FALSE, $this->originalModuleList); } } } @@ -1203,7 +1203,7 @@ class DrupalWebTestCase extends DrupalTestCase { // Reload module list and implementations to ensure that test module hooks // aren't called after tests. module_list(TRUE); - module_implements(MODULE_IMPLEMENTS_CLEAR_CACHE); + module_implements('', FALSE, TRUE); // Reset the Field API. field_cache_clear(); diff --git a/modules/simpletest/simpletest.module b/modules/simpletest/simpletest.module index cbbd45388..af176b031 100644 --- a/modules/simpletest/simpletest.module +++ b/modules/simpletest/simpletest.module @@ -31,6 +31,7 @@ function simpletest_menu() { 'page arguments' => array('simpletest_test_form'), 'description' => 'Run tests against Drupal core and your active modules. These tests help assure that your site code is working as designed.', 'access arguments' => array('administer unit tests'), + 'file' => 'simpletest.pages.inc', ); $items['admin/config/development/testing/list'] = array( 'title' => 'List', @@ -42,6 +43,7 @@ function simpletest_menu() { 'page arguments' => array('simpletest_settings_form'), 'access arguments' => array('administer unit tests'), 'type' => MENU_LOCAL_TASK, + 'file' => 'simpletest.pages.inc', ); $items['admin/config/development/testing/results/%'] = array( 'title' => 'Test result', @@ -50,6 +52,7 @@ function simpletest_menu() { 'description' => 'View result of tests.', 'access arguments' => array('administer unit tests'), 'type' => MENU_CALLBACK, + 'file' => 'simpletest.pages.inc', ); return $items; } diff --git a/modules/simpletest/tests/batch.test b/modules/simpletest/tests/batch.test index 65c5309ff..a3ace7b9e 100644 --- a/modules/simpletest/tests/batch.test +++ b/modules/simpletest/tests/batch.test @@ -69,8 +69,6 @@ class BatchAPIPercentagesTestCase extends DrupalWebTestCase { * testCases class variable. */ function testBatchAPIPercentages() { - // Include batch.inc if it's not already included. - drupal_function_exists('_batch_api_percentage'); foreach ($this->testCases as $expected_result => $arguments) { // PHP sometimes casts numeric strings that are array keys to integers, // cast them back here. @@ -86,4 +84,4 @@ class BatchAPIPercentagesTestCase extends DrupalWebTestCase { } } } -}
\ No newline at end of file +} diff --git a/modules/simpletest/tests/image.test b/modules/simpletest/tests/image.test index 7047576b6..3eeb602a8 100644 --- a/modules/simpletest/tests/image.test +++ b/modules/simpletest/tests/image.test @@ -255,7 +255,7 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase { */ function testManipulations() { // If GD isn't available don't bother testing this. - if (!drupal_function_exists('image_gd_check_settings') || !image_gd_check_settings()) { + if (!function_exists('image_gd_check_settings') || !image_gd_check_settings()) { $this->pass(t('Image manipulations for the GD toolkit were skipped because the GD toolkit is not available.')); return; } @@ -325,7 +325,7 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase { ); // Systems using non-bundled GD2 don't have imagerotate. Test if available. - if (drupal_function_exists('imagerotate')) { + if (function_exists('imagerotate')) { $operations += array( 'rotate_5' => array( 'function' => 'rotate', @@ -359,7 +359,7 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase { } // Systems using non-bundled GD2 don't have imagefilter. Test if available. - if (drupal_function_exists('imagefilter')) { + if (function_exists('imagefilter')) { $operations += array( 'desaturate' => array( 'function' => 'desaturate', diff --git a/modules/simpletest/tests/module.test b/modules/simpletest/tests/module.test index 5c703c287..a157c957a 100644 --- a/modules/simpletest/tests/module.test +++ b/modules/simpletest/tests/module.test @@ -60,7 +60,7 @@ class ModuleUnitTest extends DrupalWebTestCase { 'system' => array('filename' => drupal_get_path('module', 'system')), 'menu' => array('filename' => drupal_get_path('module', 'menu')), ); - module_list(FALSE, FALSE, $fixed_list); + module_list(FALSE, FALSE, FALSE, $fixed_list); $new_module_list = array_combine(array_keys($fixed_list), array_keys($fixed_list)); $this->assertModuleList($new_module_list, t('When using a fixed list')); @@ -79,7 +79,7 @@ class ModuleUnitTest extends DrupalWebTestCase { $expected_values = array_combine($expected_values, $expected_values); $this->assertIdentical($expected_values, module_list(), t('@condition: module_list() returns correct results', array('@condition' => $condition))); ksort($expected_values); - $this->assertIdentical($expected_values, module_list(FALSE, TRUE), t('@condition: module_list() returns correctly sorted results', array('@condition' => $condition))); + $this->assertIdentical($expected_values, module_list(FALSE, FALSE, TRUE), t('@condition: module_list() returns correctly sorted results', array('@condition' => $condition))); } } diff --git a/modules/simpletest/tests/registry.test b/modules/simpletest/tests/registry.test index 53ee3127f..09464922c 100644 --- a/modules/simpletest/tests/registry.test +++ b/modules/simpletest/tests/registry.test @@ -12,7 +12,6 @@ class RegistryParseFileTestCase extends DrupalWebTestCase { function setUp() { $this->fileName = 'registry_test_' . md5(rand()); - $this->functionName = 'registry_test_function' . md5(rand()); $this->className = 'registry_test_class' . md5(rand()); $this->interfaceName = 'registry_test_interface' . md5(rand()); parent::setUp(); @@ -23,7 +22,7 @@ class RegistryParseFileTestCase extends DrupalWebTestCase { */ function testRegistryParseFile() { _registry_parse_file($this->fileName, $this->getFileContents()); - foreach (array('functionName', 'className', 'interfaceName') as $resource) { + foreach (array('className', 'interfaceName') as $resource) { $foundName = db_query('SELECT name FROM {registry} WHERE name = :name', array(':name' => $this->$resource))->fetchField(); $this->assertTrue($this->$resource == $foundName, t('Resource "@resource" found.', array('@resource' => $this->$resource))); } @@ -36,8 +35,6 @@ class RegistryParseFileTestCase extends DrupalWebTestCase { $file_contents = <<<CONTENTS <?php -function {$this->functionName}() {} - class {$this->className} {} interface {$this->interfaceName} {} @@ -66,7 +63,6 @@ class RegistryParseFilesTestCase extends DrupalWebTestCase { foreach ($this->fileTypes as $fileType) { $this->$fileType = new stdClass(); $this->$fileType->fileName = file_directory_path() . '/registry_test_' . md5(rand()); - $this->$fileType->functionName = 'registry_test_function' . md5(rand()); $this->$fileType->className = 'registry_test_class' . md5(rand()); $this->$fileType->interfaceName = 'registry_test_interface' . md5(rand()); $this->$fileType->contents = $this->getFileContents($fileType); @@ -82,7 +78,7 @@ class RegistryParseFilesTestCase extends DrupalWebTestCase { ->execute(); // Insert some fake resource records. - foreach (array('function', 'class', 'interface') as $type) { + foreach (array('class', 'interface') as $type) { db_insert('registry') ->fields(array( 'name' => $type . md5(rand()), @@ -102,7 +98,7 @@ class RegistryParseFilesTestCase extends DrupalWebTestCase { _registry_parse_files($this->getFiles()); foreach ($this->fileTypes as $fileType) { // Test that we have all the right resources. - foreach (array('functionName', 'className', 'interfaceName') as $resource) { + foreach (array('className', 'interfaceName') as $resource) { $foundName = db_query('SELECT name FROM {registry} WHERE name = :name', array(':name' => $this->$fileType->$resource))->fetchField(); $this->assertTrue($this->$fileType->$resource == $foundName, t('Resource "@resource" found.', array('@resource' => $this->$fileType->$resource))); } @@ -135,8 +131,6 @@ class RegistryParseFilesTestCase extends DrupalWebTestCase { $file_contents = <<<CONTENTS <?php -function {$this->$fileType->functionName}() {} - class {$this->$fileType->className} {} interface {$this->$fileType->interfaceName} {} @@ -146,33 +140,3 @@ CONTENTS; } } - -class RegistrySkipBodyTestCase extends DrupalUnitTestCase { - public static function getInfo() { - return array( - 'name' => 'Skip function body test', - 'description' => 'Tokenize a simple function and check that the body is skipped right', - 'group' => 'System', - ); - } - - function testRegistrySkipBody() { - // This string contains all three kinds of opening braces. - $function = '<?php function foo () { $x = "{$y}"; $x = "${y}"; }'; - $tokens = token_get_all($function); - require_once DRUPAL_ROOT . '/includes/registry.inc'; - _registry_skip_body($tokens); - // Consume the last } - each($tokens); - $this->assertIdentical(each($tokens), FALSE, t('Tokens skipped')); - - // Check workaround for PHP < 5.2.3 regarding tokenization of strings - // containing variables. The { contained in the string should not be - // treated as a separate token. - $function = '<?php function foo() { $x = "$y {"; $x = `$y {`; $x = ' . "<<<EOD\n\$y {\nEOD\n; } function bar() {}"; - $tokens = token_get_all($function); - _registry_skip_body($tokens); - $this->assertTrue(each($tokens), t('Tokens not skipped to end of file.')); - } - -} diff --git a/modules/simpletest/tests/xmlrpc.test b/modules/simpletest/tests/xmlrpc.test index 8cdaec1d5..232665a95 100644 --- a/modules/simpletest/tests/xmlrpc.test +++ b/modules/simpletest/tests/xmlrpc.test @@ -12,9 +12,6 @@ class XMLRPCValidator1IncTestCase extends DrupalWebTestCase { function setUp() { parent::setUp('xmlrpc_test'); - - // Force loading the xmlrpc.inc to have the xmlrpc() function. - drupal_function_exists('xmlrpc'); } /** @@ -135,9 +132,6 @@ class XMLRPCMessagesTestCase extends DrupalWebTestCase { function setUp() { parent::setUp('xmlrpc_test'); - - // Force loading the xmlrpc.inc to have the xmlrpc() function. - drupal_function_exists('xmlrpc'); } /** |