Merge branch 'MDL-42942_master' of git://github.com/dmonllao/moodle

This commit is contained in:
Dan Poltawski
2013-11-27 11:32:23 +08:00
4 changed files with 75 additions and 59 deletions
+1 -1
View File
@@ -8,6 +8,6 @@
"require-dev": {
"phpunit/phpunit": "3.7.*",
"phpunit/dbUnit": "1.2.*",
"moodlehq/behat-extension": "1.26.2"
"moodlehq/behat-extension": "1.26.3"
}
}
+4 -1
View File
@@ -190,12 +190,15 @@ class behat_config_manager {
'selenium2' => null
),
'Moodle\BehatExtension\Extension' => array(
'formatters' => array(
'moodle_progress' => 'Moodle\BehatExtension\Formatter\MoodleProgressFormatter'
),
'features' => $features,
'steps_definitions' => $stepsdefinitions
)
),
'formatter' => array(
'name' => 'progress'
'name' => 'moodle_progress'
)
)
);
+1 -57
View File
@@ -272,63 +272,7 @@ class phpunit_util extends testing_util {
* @return void
*/
public static function bootstrap_moodle_info() {
global $CFG;
// All developers have to understand English, do not localise!
$release = null;
require("$CFG->dirroot/version.php");
echo "Moodle $release, $CFG->dbtype";
if ($hash = self::get_git_hash()) {
echo ", $hash";
}
echo "\n";
}
/**
* Try to get current git hash of the Moodle in $CFG->dirroot.
* @return string null if unknown, sha1 hash if known
*/
public static function get_git_hash() {
global $CFG;
// This is a bit naive, but it should mostly work for all platforms.
if (!file_exists("$CFG->dirroot/.git/HEAD")) {
return null;
}
$ref = file_get_contents("$CFG->dirroot/.git/HEAD");
if ($ref === false) {
return null;
}
$ref = trim($ref);
if (strpos($ref, 'ref: ') !== 0) {
return null;
}
$ref = substr($ref, 5);
if (!file_exists("$CFG->dirroot/.git/$ref")) {
return null;
}
$hash = file_get_contents("$CFG->dirroot/.git/$ref");
if ($hash === false) {
return null;
}
$hash = trim($hash);
if (strlen($hash) != 40) {
return null;
}
return $hash;
echo self::get_site_info();
}
/**
+69
View File
@@ -607,6 +607,75 @@ abstract class testing_util {
cache_helper::purge_all();
}
/**
* Gets a text-based site version description.
*
* @return string The site info
*/
public static function get_site_info() {
global $CFG;
$output = '';
// All developers have to understand English, do not localise!
$release = null;
require("$CFG->dirroot/version.php");
$output .= "Moodle $release, $CFG->dbtype";
if ($hash = self::get_git_hash()) {
$output .= ", $hash";
}
$output .= "\n";
return $output;
}
/**
* Try to get current git hash of the Moodle in $CFG->dirroot.
* @return string null if unknown, sha1 hash if known
*/
public static function get_git_hash() {
global $CFG;
// This is a bit naive, but it should mostly work for all platforms.
if (!file_exists("$CFG->dirroot/.git/HEAD")) {
return null;
}
$ref = file_get_contents("$CFG->dirroot/.git/HEAD");
if ($ref === false) {
return null;
}
$ref = trim($ref);
if (strpos($ref, 'ref: ') !== 0) {
return null;
}
$ref = substr($ref, 5);
if (!file_exists("$CFG->dirroot/.git/$ref")) {
return null;
}
$hash = file_get_contents("$CFG->dirroot/.git/$ref");
if ($hash === false) {
return null;
}
$hash = trim($hash);
if (strlen($hash) != 40) {
return null;
}
return $hash;
}
/**
* Drop the whole test database
* @static