function simpletest_load in SimpleTest 5
Same name and namespace in other branches
- 6 simpletest.module \simpletest_load()
Try to load the simepletest
Return value
boolean TRUE if the load succeeded
3 calls to simpletest_load()
- run_all_tests.php in ./
run_all_tests.php - simpletest_entrypoint in ./
simpletest.module - Menu callback for both running tests and listing possible tests
- simpletest_get_total_test in ./
simpletest.module - This function makes sure no unnecessary copies of the DrupalUnitTests object are instantiated
File
- ./
simpletest.module, line 60
Code
function simpletest_load() {
static $loaded;
if ($loaded) {
return true;
}
global $user;
if ($user->uid != 1) {
drupal_set_message(t('We strongly suggest running the simpletests with uid=1!'));
}
$loaded = true;
if (!defined('SIMPLE_TEST')) {
define('SIMPLE_TEST', drupal_get_path('module', 'simpletest') . '/simpletest');
}
if (!is_dir(SIMPLE_TEST)) {
$output = t('Sorry but the simpletest cannot be found in the current installation. Please notice that simpletest.module needs Simpletest framework. ' . 'Please download it from !simpletest_link and place it into the same directory as simpletest.module: %simpletest_directory', array(
'!simpletest_link' => l('Simpletest on SourceForge', 'https://sourceforge.net/project/showfiles.php?group_id=76550'),
'%simpletest_directory' => SIMPLE_TEST,
));
drupal_set_message($output, 'error');
return false;
}
/* We currently use only the web tester that DrupalTestCase is built upon */
require_once SIMPLE_TEST . '/web_tester.php';
require_once SIMPLE_TEST . '/reporter.php';
require_once 'drupal_reporter.php';
if (version_compare(SimpleTest::getVersion(), '1.0.1beta2') < 0) {
$output = t('Due to a lot of refactoring done on simpletest library side. Simpletest module is not compatible with simpeltest versions lower thab 1.0.1beta2. ' . 'Please download the latest version from !simpletest_link and place it into the same directory as simpletest.module: %simpletest_directory', array(
'!simpletest_link' => l('Simpletest on SourceForge', 'https://sourceforge.net/project/showfiles.php?group_id=76550'),
'%simpletest_directory' => SIMPLE_TEST,
));
drupal_set_message($output, 'error');
return false;
}
$path = drupal_get_path('module', 'simpletest') . '/';
require_once $path . 'drupal_test_case.php';
require_once $path . 'drupal_unit_tests.php';
return true;
}