View source
<?php
define('SIMPLETEST_MINIMUM_VERSION', '1.0.1beta2');
function simpletest_requirements($phase) {
$requirements = array();
$module_path = drupal_get_path('module', 'simpletest');
if (empty($module_path)) {
$module_path = dirname(__FILE__);
}
$simpletest_path = $module_path . '/simpletest/simpletest.php';
$t = get_t();
$simpletest_version = 0;
if (is_file($simpletest_path)) {
include_once $simpletest_path;
$simpletest_version = SimpleTest::getVersion();
}
$requirements['simpletest'] = array(
'title' => $t('SimpleTest library'),
'value' => $simpletest_version > 0 ? $simpletest_version : $t('Not found'),
);
$install_link = base_path() . $module_path . '/INSTALL.txt';
$download_link = 'http://sourceforge.net/project/showfiles.php?group_id=76550&package_id=77275';
if ($simpletest_version == 0) {
$requirements['simpletest']['description'] = $t('The SimpleTest library is not installed. You must <a href="@download">download the SimpleTest library</a> and place it your SimpleTest module folder. For more detailed instructions, see <a href="@install">INSTALL.txt</a>.', array(
'@download' => $download_link,
'@install' => $install_link,
));
$requirements['simpletest']['severity'] = REQUIREMENT_ERROR;
}
elseif (version_compare($simpletest_version, SIMPLETEST_MINIMUM_VERSION) < 0) {
$requirements['simpletest']['description'] = $t('The SimpleTest module requires at least version %minimum-version of the SimpleTest library. Please <a href="@download">download a more recent SimpleTest library</a>. For more detailed instructions, see <a href="@install">INSTALL.txt</a>.', array(
'%minimum-version' => SIMPLETEST_MINIMUM_VERSION,
'@download' => $download_link,
'@install' => $install_link,
));
$requirements['simpletest']['severity'] = REQUIREMENT_ERROR;
}
return $requirements;
}