can not use adaptable with autotests

Issue #853 new
Peter Csonka created an issue

We set

$CFG->theme = 'adaptable';

in config.php, for using adaptable theme while running behat acceptance testing on some of our custom plugins. Unfortunatelly setting the theme as default this way seems to break adaptable:

Exception - Notice: Undefined property: stdClass::$hidealertsmobile in [dirroot]/theme/adaptable/layout/includes/header.php on line 67

I beileve the problem is quite straightforward, there are no default settings which would be saved during standard install. So we tried using an other moodle config feature

$CFG->forced_plugin_settings = array('theme_adaptable' => array(
    'hidealertsmobile' => '1'
));

to save the setting from config. The moodle actually recognizes the setting (says defined in config.php), but the error on theme stays.

So do you have any solution to install the theme just from config?

thanks, Peter

Comments (5)

  1. Peter Csonka reporter

    Figured out that the behat_clean_init_config() throws out the forced_plugin_settings, fixed it, now adaptable actually gets the settings in behat too. Although I still don't understand why do I need to set these values in config, why don't they have default ones.

  2. Peter Csonka reporter

    Seems like these are all the settings which needed to set from config, now the theme works fine.

    $CFG->forced_plugin_settings = array('theme_adaptable' => array(
        'hidealertsmobile' => 0,
        'hidesocialmobile' => 0,
        'hidelogomobile' => 0,
        'hidecoursetitlemobile' => 0,
        'hidepagefootermobile' => 0
    ));
    
  3. Peter Csonka reporter

    I am actually not that familiar yet with behat, fired it up with the help of https://docs.moodle.org/dev/Running_acceptance_test . From what I've seen probably the

    php admin/tool/behat/cli/init.php
    

    installs the plugins for the test environment. I think thats the point where somehow those few config variables left out (I tried to run it with debugger, but they does not some to play well together). But I glanced over the database and the theme_adaptable has 315 config records saved to the config_plugins table when installed this way (so some kind of install for the template definetly works, and not just theme_adaptable_process_css() the default install has way more records), but that 5 mentioned before are not in there.

    Bottom line, currently the theme not really usable in behat test environment just with this forced_plugin_settings "hack", but even that needed an other core modification to make it work. Obviously it'd be much better if it just worked out of box. :)

  4. Info 3bits

    Adaptable never has been tested using behat so you can expect some errors and warnings.

    Adaptable adds actually 448 rows in mdl_config_plugins and only a few of them have a default value in lib.php. Some are missed and others simply do not have like all the uploaded images.

    We actually do not have any environment to run behat but it is in the ToDo list

  5. Log in to comment