mtrace("Acceptance tests site installed");
}
+ // Note: Do not build the themes here. This is done during the 'enable' stage.
+
} else if ($options['drop']) {
// Ensure no tests are running.
test_lock::acquire('behat');
// Enable test mode.
behat_util::start_test_mode($options['add-core-features-to-theme'], $options['optimize-runs'], $parallel, $run);
+ // Themes are only built in the 'enable' command.
+ behat_util::build_themes();
+ mtrace("Testing environment themes built");
+
// This is only displayed once for parallel install.
if (empty($run)) {
// Notify user that 2.5 profile has been converted to 3.5.
require_once(__DIR__ . '/../../filelib.php');
require_once(__DIR__ . '/../../clilib.php');
+require_once(__DIR__ . '/../../csslib.php');
use Behat\Mink\Session;
use Behat\Mink\Exception\ExpectationException;
self::store_database_state();
}
+ /**
+ * Build theme CSS.
+ */
+ public static function build_themes() {
+ global $CFG;
+ require_once("{$CFG->libdir}/outputlib.php");
+
+ $themenames = array_keys(\core_component::get_plugin_list('theme'));
+
+ // Load the theme configs.
+ $themeconfigs = array_map(function($themename) {
+ return \theme_config::load($themename);
+ }, $themenames);
+
+ // Build the list of themes and cache them in local cache.
+ $themes = theme_build_css_for_themes($themeconfigs, ['ltr'], true);
+
+ $framework = self::get_framework();
+ $storageroot = self::get_dataroot() . "/{$framework}/themedata";
+
+ foreach ($themes as $themename => $themedata) {
+ $dirname = "{$storageroot}/{$themename}";
+ check_dir_exists($dirname);
+ foreach ($themedata as $direction => $css) {
+ file_put_contents("{$dirname}/{$direction}.css", $css);
+ }
+ }
+ }
+
/**
* Drops dataroot and remove test database tables
* @throws coding_exception