MDL-55379 phpunit: Preserve config option if passed
This commit is contained in:
@@ -229,8 +229,8 @@ if (!behat_config_manager::create_parallel_site_links($options['fromrun'], $opti
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Execute all commands.
|
||||
$processes = cli_execute_parallel($cmds, __DIR__);
|
||||
// Execute all commands, relative to moodle root directory.
|
||||
$processes = cli_execute_parallel($cmds, __DIR__ . "/../../../../");
|
||||
$stoponfail = empty($options['stop-on-failure']) ? false : true;
|
||||
|
||||
// Print header.
|
||||
|
||||
@@ -106,7 +106,10 @@ class behat_command {
|
||||
|
||||
// If relative path then prefix relative path.
|
||||
if ($absolutepath) {
|
||||
$pathprefix = testing_cli_argument_path('/') . $separator;
|
||||
$pathprefix = testing_cli_argument_path('/');
|
||||
if (!empty($pathprefix)) {
|
||||
$pathprefix .= $separator;
|
||||
}
|
||||
} else {
|
||||
$pathprefix = '';
|
||||
}
|
||||
|
||||
@@ -107,6 +107,10 @@ class Hint_ResultPrinter extends PHPUnit_TextUI_ResultPrinter {
|
||||
}
|
||||
if (in_array($_SERVER['argv'][$i], array('--colors', '--verbose', '-v', '--debug'))) {
|
||||
$executable .= ' '.$_SERVER['argv'][$i];
|
||||
} else if (in_array($_SERVER['argv'][$i], array('-c', '--config'))) {
|
||||
$executable .= ' '.$_SERVER['argv'][$i] . ' ' . $_SERVER['argv'][++$i];
|
||||
} else if (strpos($_SERVER['argv'][$i], '--config') === 0) {
|
||||
$executable .= ' '.$_SERVER['argv'][$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
-8
@@ -53,20 +53,21 @@ function testing_cli_argument_path($moodlepath) {
|
||||
$cwd = getcwd();
|
||||
}
|
||||
|
||||
// In sub path, we want to remove leading Directory separator.
|
||||
$removeseparator = 0;
|
||||
if (substr($cwd, -1) !== DIRECTORY_SEPARATOR) {
|
||||
$removeseparator = 1;
|
||||
// Remove last directory separator as $path will not contain one.
|
||||
if ((substr($cwd, -1) === '/') || (substr($cwd, -1) === '\\')) {
|
||||
$cwd = substr($cwd, -1);
|
||||
}
|
||||
|
||||
$path = realpath($CFG->dirroot.$moodlepath);
|
||||
|
||||
if (strpos($path, $cwd) === 0) {
|
||||
$path = substr($path, strlen($cwd) + $removeseparator);
|
||||
}
|
||||
|
||||
// We need standrad directory seperator for path and cwd, so it can be compared.
|
||||
$cwd = testing_cli_fix_directory_separator($cwd);
|
||||
$path = testing_cli_fix_directory_separator($path);
|
||||
|
||||
if (strpos($path, $cwd) === 0) {
|
||||
$path = substr($path, strlen($cwd));
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
|
||||
@@ -186,4 +186,4 @@ class user_search_testcase extends advanced_testcase {
|
||||
$this->assertEquals(\core_search\manager::ACCESS_GRANTED, $searcharea->check_access($user2->id));
|
||||
$this->assertEquals(\core_search\manager::ACCESS_GRANTED, $searcharea->check_access($user3->id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user