MDL-69740 Behat init: more progress info at the end of the install

This commit is contained in:
Tim Hunt 2020-09-18 17:37:24 +01:00
parent 87afa4d759
commit 3a048549de
3 changed files with 16 additions and 5 deletions

View file

@ -187,10 +187,13 @@ if ($options['install']) {
behat_config_manager::set_behat_run_config_value('axe', $options['axe']); behat_config_manager::set_behat_run_config_value('axe', $options['axe']);
// Enable test mode. // Enable test mode.
$timestart = microtime(true);
mtrace('Creating Behat configuration ...', '');
behat_util::start_test_mode($options['add-core-features-to-theme'], $options['optimize-runs'], $parallel, $run); behat_util::start_test_mode($options['add-core-features-to-theme'], $options['optimize-runs'], $parallel, $run);
mtrace(' done in ' . round(microtime(true) - $timestart, 2) . ' seconds.');
// Themes are only built in the 'enable' command. // Themes are only built in the 'enable' command.
behat_util::build_themes(); behat_util::build_themes(true);
mtrace("Testing environment themes built"); mtrace("Testing environment themes built");
// This is only displayed once for parallel install. // This is only displayed once for parallel install.

View file

@ -135,7 +135,7 @@ class behat_util extends testing_util {
/** /**
* Build theme CSS. * Build theme CSS.
*/ */
public static function build_themes() { public static function build_themes($mtraceprogress = false) {
global $CFG; global $CFG;
require_once("{$CFG->libdir}/outputlib.php"); require_once("{$CFG->libdir}/outputlib.php");
@ -147,7 +147,7 @@ class behat_util extends testing_util {
}, $themenames); }, $themenames);
// Build the list of themes and cache them in local cache. // Build the list of themes and cache them in local cache.
$themes = theme_build_css_for_themes($themeconfigs, ['ltr'], true); $themes = theme_build_css_for_themes($themeconfigs, ['ltr'], true, $mtraceprogress);
$framework = self::get_framework(); $framework = self::get_framework();
$storageroot = self::get_dataroot() . "/{$framework}/themedata"; $storageroot = self::get_dataroot() . "/{$framework}/themedata";
@ -278,7 +278,6 @@ class behat_util extends testing_util {
* @return void * @return void
*/ */
public static function start_test_mode($themesuitewithallfeatures = false, $tags = '', $parallelruns = 0, $run = 0) { public static function start_test_mode($themesuitewithallfeatures = false, $tags = '', $parallelruns = 0, $run = 0) {
global $CFG;
if (!defined('BEHAT_UTIL')) { if (!defined('BEHAT_UTIL')) {
throw new coding_exception('This method can be only used by Behat CLI tool'); throw new coding_exception('This method can be only used by Behat CLI tool');

View file

@ -181,7 +181,8 @@ function theme_get_css_filename($themename, $globalrevision, $themerevision, $di
* @param bool $cache Should the generated files be stored in local cache. * @param bool $cache Should the generated files be stored in local cache.
* @return array The built theme content in a multi-dimensional array of name => direction => content * @return array The built theme content in a multi-dimensional array of name => direction => content
*/ */
function theme_build_css_for_themes($themeconfigs = [], $directions = ['rtl', 'ltr'], $cache = true): array { function theme_build_css_for_themes($themeconfigs = [], $directions = ['rtl', 'ltr'],
$cache = true, $mtraceprogress = false): array {
global $CFG; global $CFG;
if (empty($themeconfigs)) { if (empty($themeconfigs)) {
@ -202,6 +203,11 @@ function theme_build_css_for_themes($themeconfigs = [], $directions = ['rtl', 'l
// First generate all the new css. // First generate all the new css.
foreach ($directions as $direction) { foreach ($directions as $direction) {
if ($mtraceprogress) {
$timestart = microtime(true);
mtrace('Building theme CSS for ' . $themeconfig->name . ' [' .
$direction . '] ...', '');
}
// Lock it on. Technically we should build all themes for SVG and no SVG - but ie9 is out of support. // Lock it on. Technically we should build all themes for SVG and no SVG - but ie9 is out of support.
$themeconfig->force_svg_use(true); $themeconfig->force_svg_use(true);
$themeconfig->set_rtl_mode(($direction === 'rtl')); $themeconfig->set_rtl_mode(($direction === 'rtl'));
@ -212,6 +218,9 @@ function theme_build_css_for_themes($themeconfigs = [], $directions = ['rtl', 'l
$filename = theme_get_css_filename($themeconfig->name, $themerev, $newrevision, $direction); $filename = theme_get_css_filename($themeconfig->name, $themerev, $newrevision, $direction);
css_store_css($themeconfig, $filename, $themecss[$direction]); css_store_css($themeconfig, $filename, $themecss[$direction]);
} }
if ($mtraceprogress) {
mtrace(' done in ' . round(microtime(true) - $timestart, 2) . ' seconds.');
}
} }
$themescss[$themeconfig->name] = $themecss; $themescss[$themeconfig->name] = $themecss;