Commit f40532da authored by webchick's avatar webchick

#376129 by boombatower, Damien Tournoud, and chx: Change getInfo() to a static...

#376129 by boombatower, Damien Tournoud, and chx: Change getInfo() to a static method to reduce memory footprint of SimpleTest.
parent 5cc1704a
......@@ -243,7 +243,7 @@ EOF;
}
class AddFeedTestCase extends AggregatorTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Add feed functionality'),
'description' => t('Add feed test.'),
......@@ -272,7 +272,7 @@ class AddFeedTestCase extends AggregatorTestCase {
}
class UpdateFeedTestCase extends AggregatorTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Update feed functionality'),
'description' => t('Update feed test.'),
......@@ -314,7 +314,7 @@ class UpdateFeedTestCase extends AggregatorTestCase {
}
class RemoveFeedTestCase extends AggregatorTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Remove feed functionality'),
'description' => t('Remove feed test.'),
......@@ -342,7 +342,7 @@ class RemoveFeedTestCase extends AggregatorTestCase {
}
class UpdateFeedItemTestCase extends AggregatorTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Update feed item functionality'),
'description' => t('Update feed items from a feed.'),
......@@ -403,7 +403,7 @@ class UpdateFeedItemTestCase extends AggregatorTestCase {
}
class RemoveFeedItemTestCase extends AggregatorTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Remove feed item functionality'),
'description' => t('Remove feed items from a feed.'),
......@@ -443,7 +443,7 @@ class RemoveFeedItemTestCase extends AggregatorTestCase {
class CategorizeFeedItemTestCase extends AggregatorTestCase {
private static $prefix = 'simpletest_aggregator_';
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Categorize feed item functionality'),
'description' => t('Test feed item categorization.'),
......@@ -502,7 +502,7 @@ class CategorizeFeedItemTestCase extends AggregatorTestCase {
class ImportOPMLTestCase extends AggregatorTestCase {
private static $prefix = 'simpletest_aggregator_';
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Import feeds from OPML functionality'),
'description' => t('Test OPML import.'),
......
......@@ -4,7 +4,7 @@
class BlockTestCase extends DrupalWebTestCase {
protected $regions;
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Block functionality'),
'description' => t('Add, edit and delete custom block. Configure and move a module-defined block.'),
......@@ -152,7 +152,7 @@ class BlockTestCase extends DrupalWebTestCase {
}
class NonDefaultBlockAdmin extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Non default theme admin'),
'description' => t('Check the administer page for non default theme.'),
......
......@@ -6,7 +6,7 @@ class BlogTestCase extends DrupalWebTestCase {
protected $own_user;
protected $any_user;
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Blog functionality'),
'description' => t('Create, view, edit, delete, and change blog entries and verify its consistency in the database.'),
......
......@@ -2,7 +2,7 @@
// $Id$
class BlogAPITestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Blog API functionality'),
'description' => t('Create, edit, and delete post; upload file; and set/get categories.'),
......
......@@ -4,7 +4,7 @@
class BookTestCase extends DrupalWebTestCase {
protected $book;
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Book functionality'),
'description' => t('Create a book, add pages, and test book interface.'),
......@@ -174,7 +174,7 @@ class BookTestCase extends DrupalWebTestCase {
}
class BookBlockTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Block availability'),
'description' => t('Check if the book navigation block is available.'),
......
......@@ -229,7 +229,7 @@ class CommentHelperCase extends DrupalWebTestCase {
}
class CommentInterfaceTest extends CommentHelperCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Comment interface'),
'description' => t('Test comment user interfaces.'),
......@@ -359,7 +359,7 @@ class CommentInterfaceTest extends CommentHelperCase {
}
class CommentAnonymous extends CommentHelperCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Anonymous comments'),
'description' => t('Test anonymous comments.'),
......@@ -455,7 +455,7 @@ class CommentAnonymous extends CommentHelperCase {
}
class CommentApprovalTest extends CommentHelperCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Comment approval'),
'description' => t('Test comment approval functionality.'),
......@@ -537,7 +537,7 @@ class CommentApprovalTest extends CommentHelperCase {
* Functional tests for the comment module blocks.
*/
class CommentBlockFunctionalTest extends CommentHelperCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Comment blocks'),
'description' => t('Test comment block functionality.'),
......@@ -606,7 +606,7 @@ class CommentBlockFunctionalTest extends CommentHelperCase {
* Unit tests for comment module integration with RSS feeds.
*/
class CommentRSSUnitTest extends CommentHelperCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Comment RSS'),
'description' => t('Test comments as part of an RSS feed.'),
......
......@@ -5,7 +5,7 @@
* Test the sitewide contact form.
*/
class ContactSitewideTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Site-wide contact form'),
'description' => t('Tests site-wide contact form functionality.'),
......@@ -256,7 +256,7 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
* Test the personal contact form.
*/
class ContactPersonalTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Personal contact form'),
'description' => t('Tests personal contact form functionality.'),
......
......@@ -5,7 +5,7 @@ class DBLogTestCase extends DrupalWebTestCase {
protected $big_user;
protected $any_user;
function getInfo() {
public static function getInfo() {
return array(
'name' => t('DBLog functionality'),
'description' => t('Generate events and verify dblog entries; verify user access to log reports based on persmissions.'),
......
......@@ -4,7 +4,7 @@
// TODO : use drupalCreateField() / drupalCreateFieldInstance() all over ?
class FieldAttachTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Field attach tests'),
'description' => t("Test Field Attach API functions."),
......@@ -606,7 +606,7 @@ class FieldAttachTestCase extends DrupalWebTestCase {
class FieldInfoTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Field info tests'),
'description' => t("Get information about existing fields, instances and bundles."),
......@@ -712,7 +712,7 @@ class FieldInfoTestCase extends DrupalWebTestCase {
}
class FieldFormTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Field form tests'),
'description' => t("Test Field form handling."),
......@@ -919,7 +919,7 @@ class FieldFormTestCase extends DrupalWebTestCase {
}
class FieldTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Field tests'),
'description' => t("Create / read /update a field."),
......@@ -1063,7 +1063,7 @@ class FieldTestCase extends DrupalWebTestCase {
class FieldInstanceTestCase extends DrupalWebTestCase {
protected $field;
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Field instance tests'),
'description' => t("Create field entities by attaching fields to entities."),
......
......@@ -2,7 +2,7 @@
// $Id$
class FieldSqlStorageTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Field SQL storage tests'),
'description' => t("Test field SQL storage module."),
......
......@@ -4,7 +4,7 @@
class TextFieldTestCase extends DrupalWebTestCase {
protected $instance;
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Text Field'),
'description' => t("Test the creation of text fields."),
......
......@@ -2,7 +2,7 @@
// $Id$
class FilterAdminTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Filter administration functionality'),
'description' => t('Thoroughly test the administrative interface of the filter module.'),
......@@ -181,7 +181,7 @@ class FilterAdminTestCase extends DrupalWebTestCase {
class FilterTestCase extends DrupalWebTestCase {
protected $format;
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Core filters'),
'description' => t('Filter each filter individually: Convert URLs into links, Convert line breaks, Correct broken HTML, Escape all HTML, Limit allowed HTML tags.'),
......
......@@ -11,7 +11,7 @@ class ForumTestCase extends DrupalWebTestCase {
protected $root_forum;
protected $nids;
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Forum functionality'),
'description' => t('Create, view, edit, delete, and change forum entries and verify its consistency in the database.'),
......
......@@ -5,7 +5,7 @@ class HelpTestCase extends DrupalWebTestCase {
protected $big_user;
protected $any_user;
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Help functionality'),
'description' => t('Verify help display and user access to help based on persmissions.'),
......
......@@ -23,7 +23,7 @@
* Functional tests for the language configuration forms.
*/
class LocaleConfigurationTest extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Language configuration'),
'description' => t('Adds a new locale and tests changing its status and the default language.'),
......@@ -165,7 +165,7 @@ class LocaleConfigurationTest extends DrupalWebTestCase {
* Functional test for string translation and validation.
*/
class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('String translate, search and validate'),
'description' => t('Adds a new locale and translates its name. Checks the validation of translation strings and search results.'),
......@@ -528,7 +528,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
* Functional tests for the import of translation files.
*/
class LocaleImportFunctionalTest extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Translation import'),
'description' => t('Tests the importation of locale files.'),
......@@ -778,7 +778,7 @@ EOF;
* Functional tests for the export of translation files.
*/
class LocaleExportFunctionalTest extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Translation export'),
'description' => t('Tests the exportation of locale files.'),
......@@ -860,7 +860,7 @@ EOF;
* Locale uninstall with English UI functional test.
*/
class LocaleUninstallFunctionalTest extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Locale uninstall (EN)'),
'description' => t('Tests the uninstall process using the built-in UI language.'),
......@@ -966,7 +966,7 @@ class LocaleUninstallFunctionalTest extends DrupalWebTestCase {
* to test with this new language.
*/
class LocaleUninstallFrenchFunctionalTest extends LocaleUninstallFunctionalTest {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Locale uninstall (FR)'),
'description' => t('Tests the uninstall process using French as UI language.'),
......@@ -986,7 +986,7 @@ class LocaleUninstallFrenchFunctionalTest extends LocaleUninstallFunctionalTest
*/
class LanguageSwitchingFunctionalTest extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Language switching'),
'description' => t('Tests for the language switching feature.'),
......@@ -1065,7 +1065,7 @@ class LanguageSwitchingFunctionalTest extends DrupalWebTestCase {
* Functional tests for a user's ability to change their default language.
*/
class LocaleUserLanguageFunctionalTest extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('User language settings'),
'description' => t("Tests user's ability to change their default language."),
......@@ -1160,7 +1160,7 @@ class LocaleUserLanguageFunctionalTest extends DrupalWebTestCase {
* Functional tests for configuring a different path alias per language.
*/
class LocalePathFunctionalTest extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Path language settings'),
'description' => t('Checks you can configure a language for individual url aliases.'),
......@@ -1243,7 +1243,7 @@ class LocalePathFunctionalTest extends DrupalWebTestCase {
* Functional tests for multilingual support on nodes.
*/
class LocaleContentFunctionalTest extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Content language settings'),
'description' => t('Checks you can enable multilingual support on content types and configure a language for a node.'),
......
......@@ -7,7 +7,7 @@ class MenuTestCase extends DrupalWebTestCase {
protected $menu;
protected $items;
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Menu link creation/deletion'),
'description' => t('Add a custom menu, add menu links to the custom menu and Navigation menu, check their data, and delete them using the menu module UI.'),
......
......@@ -6,7 +6,7 @@
*/
class NodeLoadMultipleUnitTest extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Load multiple nodes'),
'description' => t('Test the loading of multiple nodes.'),
......@@ -85,7 +85,7 @@ class NodeRevisionsTestCase extends DrupalWebTestCase {
protected $nodes;
protected $logs;
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Node revisions'),
'description' => t('Create a node with revisions and test viewing, reverting, and deleting revisions.'),
......@@ -167,7 +167,7 @@ class NodeRevisionsTestCase extends DrupalWebTestCase {
}
class NodeTeaserTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Node teaser'),
'description' => t('Test node_teaser() with different strings and lengths.'),
......@@ -312,7 +312,7 @@ class NodeTeaserTestCase extends DrupalWebTestCase {
}
class PageEditTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Node edit'),
'description' => t('Create a node and test node edit functionality.'),
......@@ -366,7 +366,7 @@ class PageEditTestCase extends DrupalWebTestCase {
}
class PagePreviewTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Node preview'),
'description' => t('Test node preview functionality.'),
......@@ -403,7 +403,7 @@ class PagePreviewTestCase extends DrupalWebTestCase {
}
class PageCreationTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Node creation'),
'description' => t('Create a node and test saving it.'),
......@@ -438,7 +438,7 @@ class PageCreationTestCase extends DrupalWebTestCase {
}
class PageViewTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Node edit permissions'),
'description' => t('Create a node and test edit permissions.'),
......@@ -477,7 +477,7 @@ class PageViewTestCase extends DrupalWebTestCase {
}
class NodeTitleXSSTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Node title XSS filtering'),
'description' => t('Create a node with dangerous tags in its title and test that they are escaped.'),
......@@ -511,7 +511,7 @@ class NodeTitleXSSTestCase extends DrupalWebTestCase {
}
class NodeBlockTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Block availability'),
'description' => t('Check if the syndicate block is available.'),
......@@ -544,7 +544,7 @@ class NodeBlockTestCase extends DrupalWebTestCase {
* Check that the post information displays when enabled for a content type.
*/
class NodePostSettingsTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Node post information display'),
'description' => t('Check that the post information (submitted by Username on date) text displays appropriately.'),
......@@ -610,7 +610,7 @@ class NodePostSettingsTestCase extends DrupalWebTestCase {
* sitewide RSS feed at rss.xml.
*/
class NodeRSSContentTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Node RSS Content'),
'description' => t('Ensure that data added to nodes by other modules appears in RSS feeds.'),
......
......@@ -2,7 +2,7 @@
// $Id$
class PathTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Path alias functionality'),
'description' => t('Add, edit, delete, and change alias and verify its consistency in the database.'),
......@@ -126,7 +126,7 @@ class PathTestCase extends DrupalWebTestCase {
}
class PathLanguageTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Path aliases with translated nodes'),
'description' => t('Confirm that paths work with translated nodes'),
......
......@@ -37,7 +37,7 @@ class PHPTestCase extends DrupalWebTestCase {
* Tests to make sure the PHP filter actually evaluates PHP code when used.
*/
class PHPFilterTestCase extends PHPTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('PHP filter functionality'),
'description' => t('Make sure that PHP filter properly evaluates PHP code when enabled.'),
......@@ -80,7 +80,7 @@ class PHPFilterTestCase extends PHPTestCase {
* Tests to make sure access to the PHP filter is properly restricted.
*/
class PHPAccessTestCase extends PHPTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('PHP filter access check'),
'description' => t('Make sure that users who don\'t have access to the PHP filter can\'t see it.'),
......
......@@ -74,7 +74,7 @@ class PollTestCase extends DrupalWebTestCase {
}
class PollCreateTestCase extends PollTestCase {
function getInfo() {
public static function getInfo() {
return array('name' => t('Poll create'), 'description' => 'Adds "more choices", previews and creates a poll.', 'group' => t('Poll'));
}
......@@ -90,7 +90,7 @@ class PollCreateTestCase extends PollTestCase {
}
class PollVoteTestCase extends PollTestCase {
function getInfo() {
public static function getInfo() {
return array('name' => t('Poll vote'), 'description' => 'Vote on a poll', 'group' => t('Poll'));
}
......@@ -125,7 +125,7 @@ class PollVoteTestCase extends PollTestCase {
}
class PollBlockTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Block availability'),
'description' => t('Check if the most recent poll block is available.'),
......@@ -159,7 +159,7 @@ class PollBlockTestCase extends DrupalWebTestCase {
*/
class PollJSAddChoice extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Poll add choice'),
'description' => t('Submits a POST request for an additional poll choice.'),
......
......@@ -114,7 +114,7 @@ class ProfileTestCase extends DrupalWebTestCase {
}
class ProfileTestFields extends ProfileTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => 'Test single fields',
'description' => t('Testing profile module with add/edit/delete textfield, textarea, list, checkbox, and url fields into profile page') ,
......@@ -149,7 +149,7 @@ class ProfileTestFields extends ProfileTestCase {
}
class ProfileTestSelect extends ProfileTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => 'Test select field',
'description' => t('Testing profile module with add/edit/delete a select field') ,
......@@ -174,7 +174,7 @@ class ProfileTestSelect extends ProfileTestCase {
}
class ProfileTestDate extends ProfileTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => 'Test date field',
'description' => t('Testing profile module with add/edit/delete a date field') ,
......@@ -210,7 +210,7 @@ class ProfileTestDate extends ProfileTestCase {
}
class ProfileTestWeights extends ProfileTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => 'Test field weights',
'description' => t('Testing profile modules weigting of fields') ,
......@@ -239,7 +239,7 @@ class ProfileTestWeights extends ProfileTestCase {
* Test profile field autocompletion and access.
*/
class ProfileTestAutocomplete extends ProfileTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Autocompletion'),
'description' => t('Test profile fields with autocompletion.'),
......@@ -292,7 +292,7 @@ class ProfileTestAutocomplete extends ProfileTestCase {
}
class ProfileBlockTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Block availability'),
'description' => t('Check if the author-information block is available.'),
......
......@@ -7,7 +7,7 @@ define('SEARCH_TYPE', '_test_');
define('SEARCH_TYPE_2', '_test2_');
class SearchMatchTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Search engine queries'),
'description' => t('Indexes content and queries it.'),
......@@ -197,7 +197,7 @@ class SearchMatchTestCase extends DrupalWebTestCase {
class SearchBikeShed extends DrupalWebTestCase {
protected $searching_user;
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Bike shed'),
'description' => t('Tests the bike shed text on the no results page.'),
......@@ -227,7 +227,7 @@ class SearchBikeShed extends DrupalWebTestCase {
class SearchAdvancedSearchForm extends DrupalWebTestCase {
protected $node;
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Advanced search form'),
'description' => t('Indexes content and tests the advanced search form.'),
......@@ -288,7 +288,7 @@ class SearchAdvancedSearchForm extends DrupalWebTestCase {
}
class SearchRankingTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Search engine ranking'),
'description' => t('Indexes content and tests ranking factors.'),
......@@ -371,7 +371,7 @@ class SearchRankingTestCase extends DrupalWebTestCase {
}
class SearchBlockTestCase extends DrupalWebTestCase {
function getInfo() {
public static function getInfo() {
return array(
'name' => t('Block availability'),
'description' => t('Check if the search form block is available.'),
......
......@@ -89,7 +89,7 @@ function simpletest_test_form() {
$header = array(t('Message'), t('Group'), t('Filename'), t('Line'), t('Function'), array('colspan' => 2, 'data' => t('Status')));
while ($result = db_fetch_object($results)) {
$class = $result->test_class;
$info = $uncategorized_tests[$class]->getInfo();
$info = call_user_func(array($class, 'getInfo'));
$group = $info['group'];
$selected_tests[$group][$class] = TRUE;
if (!isset($group_summary[$group])) {
......@@ -130,7 +130,7 @@ function simpletest_test_form() {
foreach ($form['results'] as $group => &$elements) {
$group_ok = TRUE;
foreach ($elements as $class => &$element) {
$info = $uncategorized_tests[$class]->getInfo();
$info = call_user_func(array($class, 'getInfo'));
$ok = $element['summary']['#fail'] + $element['summary']['#exception'] == 0;
$element += array(
'#type' => 'fieldset',
......@@ -166,15 +166,13 @@ function simpletest_test_form() {
$form['tests']['table'][$group_name] = array(
'#collapsed' => TRUE,
);
foreach ($test_group as $test) {
$test_info = $test->getInfo();
$test_class = get_class($test);
$is_selected = isset($selected_tests[$group_name][$test_class]);
$form['tests']['table'][$group_name][$test_class] = array(
foreach ($test_group as $class => $info) {
$is_selected = isset($selected_tests[$group_name][$class]);
$form['tests']['table'][$group_name][$class] = array(
'#type' => 'checkbox',
'#title' => $test_info['name'],
'#title' => $info['name'],
'#default_value' => $is_selected,
'#description' => $test_info['description'],
'#description' => $info['description'],
);
if ($is_selected) {
$form['tests']['table'][$group_name]['#collapsed'] = FALSE;
......@@ -475,18 +473,17 @@ function simpletest_get_all_tests() {
include_once DRUPAL_ROOT . '/' . $file;
}
$classes = array_values(array_diff(get_declared_classes(), $existing_classes));
$formatted_classes = array();
foreach ($classes as $key => $class) {
if (method_exists($class, 'getInfo')) {
$formatted_classes[$class] = new $class;
if (!method_exists($class, 'getInfo')) {
unset($classes[$key]);
}
}
}
if (count($formatted_classes) == 0) {
if (count($classes) == 0) {
drupal_set_message('No test cases found.', 'error');
return FALSE;
}
return $formatted_classes;
return $classes;
}
/**
......@@ -498,9 +495,9 @@ function simpletest_get_all_tests() {
*/
function simpletest_categorize_tests($tests) {
$groups = array();
foreach ($tests as $test => $instance) {
$info = $instance->getInfo();
$groups[$info['group']][$test] = $instance;
foreach ($tests as $test) {
$info = call_user_func(array($test, 'getInfo'));
$groups[$info['group']][$test] = $info;
}
uksort($groups, 'strnatcasecmp');
return $groups;
......
......@@ -13,7 +13,7 @@ class SimpleTestFunctionalTest extends DrupalWebTestCase {
*/
protected $test_ids = array();
function getInfo() {