mirror of
https://github.com/moodle/moodle.git
synced 2025-07-27 01:10:51 +02:00
MDL-64506 phpunit: Update unit tests to use classic
This commit is contained in:
@@ -83,7 +83,7 @@ Examples:
|
|||||||
Stores the given configuration variable in the shell variable, escaped
|
Stores the given configuration variable in the shell variable, escaped
|
||||||
so that it can be safely used as a shell argument.
|
so that it can be safely used as a shell argument.
|
||||||
|
|
||||||
# php cfg.php --name=theme --set=clean
|
# php cfg.php --name=theme --set=classic
|
||||||
Sets the given configuration variable to the given value.
|
Sets the given configuration variable to the given value.
|
||||||
|
|
||||||
# php cfg.php --name=noemailever --unset
|
# php cfg.php --name=noemailever --unset
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
"visible": true,
|
"visible": true,
|
||||||
"idnumber": "014",
|
"idnumber": "014",
|
||||||
"description": "Some users",
|
"description": "Some users",
|
||||||
"theme": "clean"
|
"theme": "classic"
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
{{> tool_lp/form-cohort-selector-suggestion }}
|
{{> tool_lp/form-cohort-selector-suggestion }}
|
||||||
|
@@ -403,7 +403,7 @@ class tool_uploadcourse_course_testcase extends advanced_testcase {
|
|||||||
'idnumber' => 'changeidn',
|
'idnumber' => 'changeidn',
|
||||||
'summary' => 'Summary 2',
|
'summary' => 'Summary 2',
|
||||||
'format' => 'topics',
|
'format' => 'topics',
|
||||||
'theme' => 'clean',
|
'theme' => 'classic',
|
||||||
'lang' => '',
|
'lang' => '',
|
||||||
'newsitems' => '2',
|
'newsitems' => '2',
|
||||||
'showgrades' => '1',
|
'showgrades' => '1',
|
||||||
@@ -566,7 +566,7 @@ class tool_uploadcourse_course_testcase extends advanced_testcase {
|
|||||||
'idnumber' => 'changedid',
|
'idnumber' => 'changedid',
|
||||||
'summary' => 'Summary 2',
|
'summary' => 'Summary 2',
|
||||||
'format' => 'topics',
|
'format' => 'topics',
|
||||||
'theme' => 'clean',
|
'theme' => 'classic',
|
||||||
'lang' => '',
|
'lang' => '',
|
||||||
'newsitems' => '2',
|
'newsitems' => '2',
|
||||||
'showgrades' => '1',
|
'showgrades' => '1',
|
||||||
|
@@ -56,17 +56,17 @@ class tool_usertours_theme_filter_testcase extends advanced_testcase {
|
|||||||
true,
|
true,
|
||||||
],
|
],
|
||||||
'Multiple values set including matching; Matches' => [
|
'Multiple values set including matching; Matches' => [
|
||||||
['boost', 'clean'],
|
['boost', 'classic'],
|
||||||
'boost',
|
'boost',
|
||||||
true,
|
true,
|
||||||
],
|
],
|
||||||
'Single value set; No match' => [
|
'Single value set; No match' => [
|
||||||
['clean'],
|
['classic'],
|
||||||
'boost',
|
'boost',
|
||||||
false,
|
false,
|
||||||
],
|
],
|
||||||
'Multiple values set; No match' => [
|
'Multiple values set; No match' => [
|
||||||
['clean', 'artificial'],
|
['classic', 'artificial'],
|
||||||
'boost',
|
'boost',
|
||||||
false,
|
false,
|
||||||
],
|
],
|
||||||
|
@@ -170,13 +170,13 @@ Feature: A privileged user can create cohorts using a CSV file
|
|||||||
And I upload "cohort/tests/fixtures/uploadcohorts4.csv" file to "File" filemanager
|
And I upload "cohort/tests/fixtures/uploadcohorts4.csv" file to "File" filemanager
|
||||||
And I click on "Preview" "button"
|
And I click on "Preview" "button"
|
||||||
Then the following should exist in the "previewuploadedcohorts" table:
|
Then the following should exist in the "previewuploadedcohorts" table:
|
||||||
| name | idnumber | description | Context | visible | theme | Status |
|
| name | idnumber | description | Context | visible | theme | Status |
|
||||||
| cohort name 1 | cohortid1 | first description | System | 1 | boost | |
|
| cohort name 1 | cohortid1 | first description | System | 1 | boost | |
|
||||||
| cohort name 2 | cohortid2 | | System | 1 | | |
|
| cohort name 2 | cohortid2 | | System | 1 | | |
|
||||||
| cohort name 3 | cohortid3 | | Miscellaneous | 0 | boost | |
|
| cohort name 3 | cohortid3 | | Miscellaneous | 0 | boost | |
|
||||||
| cohort name 4 | cohortid4 | | Cat 1 | 1 | clean | |
|
| cohort name 4 | cohortid4 | | Cat 1 | 1 | classic | |
|
||||||
| cohort name 5 | cohortid5 | | Cat 2 | 0 | | |
|
| cohort name 5 | cohortid5 | | Cat 2 | 0 | | |
|
||||||
| cohort name 6 | cohortid6 | | Cat 3 | 1 | clean | |
|
| cohort name 6 | cohortid6 | | Cat 3 | 1 | classic | |
|
||||||
And I press "Upload cohorts"
|
And I press "Upload cohorts"
|
||||||
And I should see "Uploaded 6 cohorts"
|
And I should see "Uploaded 6 cohorts"
|
||||||
And I press "Continue"
|
And I press "Continue"
|
||||||
|
@@ -671,7 +671,7 @@ class core_cohort_cohortlib_testcase extends advanced_testcase {
|
|||||||
|
|
||||||
$systemctx = context_system::instance();
|
$systemctx = context_system::instance();
|
||||||
$cohort1 = $this->getDataGenerator()->create_cohort(array('contextid' => $systemctx->id, 'name' => 'test cohort 1',
|
$cohort1 = $this->getDataGenerator()->create_cohort(array('contextid' => $systemctx->id, 'name' => 'test cohort 1',
|
||||||
'idnumber' => 'testid1', 'description' => 'test cohort desc', 'descriptionformat' => FORMAT_HTML, 'theme' => 'clean'));
|
'idnumber' => 'testid1', 'description' => 'test cohort desc', 'descriptionformat' => FORMAT_HTML, 'theme' => 'classic'));
|
||||||
|
|
||||||
$id = cohort_add_cohort($cohort1);
|
$id = cohort_add_cohort($cohort1);
|
||||||
$this->assertNotEmpty($id);
|
$this->assertNotEmpty($id);
|
||||||
@@ -690,7 +690,7 @@ class core_cohort_cohortlib_testcase extends advanced_testcase {
|
|||||||
set_config('allowcohortthemes', 0);
|
set_config('allowcohortthemes', 0);
|
||||||
|
|
||||||
$cohort2 = $this->getDataGenerator()->create_cohort(array('contextid' => $systemctx->id, 'name' => 'test cohort 2',
|
$cohort2 = $this->getDataGenerator()->create_cohort(array('contextid' => $systemctx->id, 'name' => 'test cohort 2',
|
||||||
'idnumber' => 'testid2', 'description' => 'test cohort desc', 'descriptionformat' => FORMAT_HTML, 'theme' => 'clean'));
|
'idnumber' => 'testid2', 'description' => 'test cohort desc', 'descriptionformat' => FORMAT_HTML, 'theme' => 'classic'));
|
||||||
|
|
||||||
$id = cohort_add_cohort($cohort2);
|
$id = cohort_add_cohort($cohort2);
|
||||||
$this->assertNotEmpty($id);
|
$this->assertNotEmpty($id);
|
||||||
@@ -713,14 +713,14 @@ class core_cohort_cohortlib_testcase extends advanced_testcase {
|
|||||||
|
|
||||||
$systemctx = context_system::instance();
|
$systemctx = context_system::instance();
|
||||||
$cohort1 = $this->getDataGenerator()->create_cohort(array('contextid' => $systemctx->id, 'name' => 'test cohort 1',
|
$cohort1 = $this->getDataGenerator()->create_cohort(array('contextid' => $systemctx->id, 'name' => 'test cohort 1',
|
||||||
'idnumber' => 'testid1', 'description' => 'test cohort desc', 'descriptionformat' => FORMAT_HTML, 'theme' => 'clean'));
|
'idnumber' => 'testid1', 'description' => 'test cohort desc', 'descriptionformat' => FORMAT_HTML, 'theme' => 'classic'));
|
||||||
$id = cohort_add_cohort($cohort1);
|
$id = cohort_add_cohort($cohort1);
|
||||||
$this->assertNotEmpty($id);
|
$this->assertNotEmpty($id);
|
||||||
|
|
||||||
// Theme is updated when allowcohortthemes is enabled.
|
// Theme is updated when allowcohortthemes is enabled.
|
||||||
$cohort1 = $DB->get_record('cohort', array('id' => $id));
|
$cohort1 = $DB->get_record('cohort', array('id' => $id));
|
||||||
$cohort1->name = 'test cohort 1 updated';
|
$cohort1->name = 'test cohort 1 updated';
|
||||||
$cohort1->theme = 'more';
|
$cohort1->theme = 'classic';
|
||||||
cohort_update_cohort($cohort1);
|
cohort_update_cohort($cohort1);
|
||||||
$updatedcohort = $DB->get_record('cohort', array('id' => $id));
|
$updatedcohort = $DB->get_record('cohort', array('id' => $id));
|
||||||
$this->assertEquals($cohort1->contextid, $updatedcohort->contextid);
|
$this->assertEquals($cohort1->contextid, $updatedcohort->contextid);
|
||||||
@@ -732,7 +732,7 @@ class core_cohort_cohortlib_testcase extends advanced_testcase {
|
|||||||
// Theme is not updated neither overwritten when allowcohortthemes is disabled.
|
// Theme is not updated neither overwritten when allowcohortthemes is disabled.
|
||||||
set_config('allowcohortthemes', 0);
|
set_config('allowcohortthemes', 0);
|
||||||
$cohort2 = $DB->get_record('cohort', array('id' => $id));
|
$cohort2 = $DB->get_record('cohort', array('id' => $id));
|
||||||
$cohort2->theme = 'clean';
|
$cohort2->theme = 'classic';
|
||||||
cohort_update_cohort($cohort2);
|
cohort_update_cohort($cohort2);
|
||||||
$updatedcohort = $DB->get_record('cohort', array('id' => $id));
|
$updatedcohort = $DB->get_record('cohort', array('id' => $id));
|
||||||
$this->assertEquals($cohort2->contextid, $updatedcohort->contextid);
|
$this->assertEquals($cohort2->contextid, $updatedcohort->contextid);
|
||||||
|
@@ -52,7 +52,7 @@ class core_cohort_externallib_testcase extends externallib_advanced_testcase {
|
|||||||
'name' => 'cohort test 1',
|
'name' => 'cohort test 1',
|
||||||
'idnumber' => 'cohorttest1',
|
'idnumber' => 'cohorttest1',
|
||||||
'description' => 'This is a description for cohorttest1',
|
'description' => 'This is a description for cohorttest1',
|
||||||
'theme' => 'clean'
|
'theme' => 'classic'
|
||||||
);
|
);
|
||||||
|
|
||||||
$cohort2 = array(
|
$cohort2 = array(
|
||||||
@@ -76,7 +76,7 @@ class core_cohort_externallib_testcase extends externallib_advanced_testcase {
|
|||||||
'name' => 'cohort test 4',
|
'name' => 'cohort test 4',
|
||||||
'idnumber' => 'cohorttest4',
|
'idnumber' => 'cohorttest4',
|
||||||
'description' => 'This is a description for cohorttest4',
|
'description' => 'This is a description for cohorttest4',
|
||||||
'theme' => 'clean'
|
'theme' => 'classic'
|
||||||
);
|
);
|
||||||
|
|
||||||
// Call the external function.
|
// Call the external function.
|
||||||
@@ -182,7 +182,7 @@ class core_cohort_externallib_testcase extends externallib_advanced_testcase {
|
|||||||
'name' => 'cohortnametest1',
|
'name' => 'cohortnametest1',
|
||||||
'idnumber' => 'idnumbertest1',
|
'idnumber' => 'idnumbertest1',
|
||||||
'description' => 'This is a description for cohort 1',
|
'description' => 'This is a description for cohort 1',
|
||||||
'theme' => 'clean'
|
'theme' => 'classic'
|
||||||
);
|
);
|
||||||
$cohort1 = self::getDataGenerator()->create_cohort($cohort1);
|
$cohort1 = self::getDataGenerator()->create_cohort($cohort1);
|
||||||
$cohort2 = self::getDataGenerator()->create_cohort();
|
$cohort2 = self::getDataGenerator()->create_cohort();
|
||||||
@@ -250,7 +250,7 @@ class core_cohort_externallib_testcase extends externallib_advanced_testcase {
|
|||||||
'name' => 'cohortnametest1',
|
'name' => 'cohortnametest1',
|
||||||
'idnumber' => 'idnumbertest1',
|
'idnumber' => 'idnumbertest1',
|
||||||
'description' => 'This is a description for cohort 1',
|
'description' => 'This is a description for cohort 1',
|
||||||
'theme' => 'clean'
|
'theme' => 'classic'
|
||||||
);
|
);
|
||||||
|
|
||||||
$context = context_system::instance();
|
$context = context_system::instance();
|
||||||
@@ -279,15 +279,15 @@ class core_cohort_externallib_testcase extends externallib_advanced_testcase {
|
|||||||
|
|
||||||
// Call when $CFG->allowcohortthemes is enabled.
|
// Call when $CFG->allowcohortthemes is enabled.
|
||||||
set_config('allowcohortthemes', 1);
|
set_config('allowcohortthemes', 1);
|
||||||
core_cohort_external::update_cohorts(array($cohort1 + array('theme' => 'clean')));
|
core_cohort_external::update_cohorts(array($cohort1 + array('theme' => 'classic')));
|
||||||
$dbcohort = $DB->get_record('cohort', array('id' => $cohort1['id']));
|
$dbcohort = $DB->get_record('cohort', array('id' => $cohort1['id']));
|
||||||
$this->assertEquals('clean', $dbcohort->theme);
|
$this->assertEquals('classic', $dbcohort->theme);
|
||||||
|
|
||||||
// Call when $CFG->allowcohortthemes is disabled.
|
// Call when $CFG->allowcohortthemes is disabled.
|
||||||
set_config('allowcohortthemes', 0);
|
set_config('allowcohortthemes', 0);
|
||||||
core_cohort_external::update_cohorts(array($cohort1 + array('theme' => 'more')));
|
core_cohort_external::update_cohorts(array($cohort1 + array('theme' => 'boost')));
|
||||||
$dbcohort = $DB->get_record('cohort', array('id' => $cohort1['id']));
|
$dbcohort = $DB->get_record('cohort', array('id' => $cohort1['id']));
|
||||||
$this->assertEquals('clean', $dbcohort->theme);
|
$this->assertEquals('classic', $dbcohort->theme);
|
||||||
|
|
||||||
// Call without required capability.
|
// Call without required capability.
|
||||||
$this->unassignUserCapability('moodle/cohort:manage', $context->id, $roleid);
|
$this->unassignUserCapability('moodle/cohort:manage', $context->id, $roleid);
|
||||||
|
4
cohort/tests/fixtures/uploadcohorts4.csv
vendored
4
cohort/tests/fixtures/uploadcohorts4.csv
vendored
@@ -2,6 +2,6 @@ name,idnumber,description,category,visible,theme
|
|||||||
cohort name 1,cohortid1,first description,,,boost
|
cohort name 1,cohortid1,first description,,,boost
|
||||||
cohort name 2,cohortid2,,,,
|
cohort name 2,cohortid2,,,,
|
||||||
cohort name 3,cohortid3,,Miscellaneous,no,boost
|
cohort name 3,cohortid3,,Miscellaneous,no,boost
|
||||||
cohort name 4,cohortid4,,CAT1,yes,clean
|
cohort name 4,cohortid4,,CAT1,yes,classic
|
||||||
cohort name 5,cohortid5,,CAT2,0,
|
cohort name 5,cohortid5,,CAT2,0,
|
||||||
cohort name 6,cohortid6,,CAT3,1,clean
|
cohort name 6,cohortid6,,CAT3,1,classic
|
||||||
|
|
@@ -67,7 +67,7 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
|
|||||||
$category2->name = 'Root Test Category 2';
|
$category2->name = 'Root Test Category 2';
|
||||||
$category2->idnumber = 'rootcattest2';
|
$category2->idnumber = 'rootcattest2';
|
||||||
$category2->desc = 'Description for root test category 1';
|
$category2->desc = 'Description for root test category 1';
|
||||||
$category2->theme = 'bootstrapbase';
|
$category2->theme = 'classic';
|
||||||
$categories = array(
|
$categories = array(
|
||||||
array('name' => $category1->name, 'parent' => 0),
|
array('name' => $category1->name, 'parent' => 0),
|
||||||
array('name' => $category2->name, 'parent' => 0, 'idnumber' => $category2->idnumber,
|
array('name' => $category2->name, 'parent' => 0, 'idnumber' => $category2->idnumber,
|
||||||
@@ -451,7 +451,7 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
|
|||||||
$course2['enablecompletion'] = 1;
|
$course2['enablecompletion'] = 1;
|
||||||
$course2['completionnotify'] = 1;
|
$course2['completionnotify'] = 1;
|
||||||
$course2['lang'] = 'en';
|
$course2['lang'] = 'en';
|
||||||
$course2['forcetheme'] = 'bootstrapbase';
|
$course2['forcetheme'] = 'classic';
|
||||||
$course2['courseformatoptions'][] = array('name' => 'automaticenddate', 'value' => 0);
|
$course2['courseformatoptions'][] = array('name' => 'automaticenddate', 'value' => 0);
|
||||||
$course3['fullname'] = 'Test course 3';
|
$course3['fullname'] = 'Test course 3';
|
||||||
$course3['shortname'] = 'Testcourse3';
|
$course3['shortname'] = 'Testcourse3';
|
||||||
@@ -1438,7 +1438,7 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
|
|||||||
$course2['defaultgroupingid'] = 0;
|
$course2['defaultgroupingid'] = 0;
|
||||||
$course2['enablecompletion'] = 1;
|
$course2['enablecompletion'] = 1;
|
||||||
$course2['lang'] = 'en';
|
$course2['lang'] = 'en';
|
||||||
$course2['forcetheme'] = 'bootstrapbase';
|
$course2['forcetheme'] = 'classic';
|
||||||
|
|
||||||
$course3['id'] = $originalcourse3->id;
|
$course3['id'] = $originalcourse3->id;
|
||||||
$updatedcustomfieldvalue = ['shortname' => 'test', 'value' => 'Updated test value'];
|
$updatedcustomfieldvalue = ['shortname' => 'test', 'value' => 'Updated test value'];
|
||||||
|
@@ -1654,9 +1654,10 @@ class core_plugin_manager {
|
|||||||
'repository' => array('alfresco'),
|
'repository' => array('alfresco'),
|
||||||
'tinymce' => array('dragmath'),
|
'tinymce' => array('dragmath'),
|
||||||
'tool' => array('bloglevelupgrade', 'qeupgradehelper', 'timezoneimport', 'assignmentupgrade'),
|
'tool' => array('bloglevelupgrade', 'qeupgradehelper', 'timezoneimport', 'assignmentupgrade'),
|
||||||
'theme' => array('afterburner', 'anomaly', 'arialist', 'base', 'binarius', 'boxxie', 'brick', 'canvas',
|
'theme' => array('bootstrapbase', 'clean', 'more', 'afterburner', 'anomaly', 'arialist', 'base',
|
||||||
'formal_white', 'formfactor', 'fusion', 'leatherbound', 'magazine', 'mymobile', 'nimble', 'nonzero',
|
'binarius', 'boxxie', 'brick', 'canvas', 'formal_white', 'formfactor', 'fusion', 'leatherbound',
|
||||||
'overlay', 'serenity', 'sky_high', 'splash', 'standard', 'standardold'),
|
'magazine', 'mymobile', 'nimble', 'nonzero', 'overlay', 'serenity', 'sky_high', 'splash',
|
||||||
|
'standard', 'standardold'),
|
||||||
'webservice' => array('amf'),
|
'webservice' => array('amf'),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1905,7 +1906,7 @@ class core_plugin_manager {
|
|||||||
),
|
),
|
||||||
|
|
||||||
'theme' => array(
|
'theme' => array(
|
||||||
'boost', 'classic', 'bootstrapbase', 'clean', 'more'
|
'boost', 'classic'
|
||||||
),
|
),
|
||||||
|
|
||||||
'tool' => array(
|
'tool' => array(
|
||||||
|
@@ -34,7 +34,7 @@ class theme extends base {
|
|||||||
public function is_uninstall_allowed() {
|
public function is_uninstall_allowed() {
|
||||||
global $CFG;
|
global $CFG;
|
||||||
|
|
||||||
if ($this->name === 'bootstrapbase') {
|
if ($this->name === 'boost') {
|
||||||
// All of these are protected for now.
|
// All of these are protected for now.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -739,11 +739,7 @@ class theme_config {
|
|||||||
$this->name = $config->name;
|
$this->name = $config->name;
|
||||||
$this->dir = $config->dir;
|
$this->dir = $config->dir;
|
||||||
|
|
||||||
if ($this->name != 'bootstrapbase') {
|
$baseconfig = $config;
|
||||||
$baseconfig = theme_config::find_theme_config('bootstrapbase', $this->settings);
|
|
||||||
} else {
|
|
||||||
$baseconfig = $config;
|
|
||||||
}
|
|
||||||
|
|
||||||
$configurable = array(
|
$configurable = array(
|
||||||
'parents', 'sheets', 'parents_exclude_sheets', 'plugins_exclude_sheets', 'usefallback',
|
'parents', 'sheets', 'parents_exclude_sheets', 'plugins_exclude_sheets', 'usefallback',
|
||||||
|
@@ -155,20 +155,20 @@ class core_admintree_testcase extends advanced_testcase {
|
|||||||
global $CFG;
|
global $CFG;
|
||||||
$this->resetAfterTest();
|
$this->resetAfterTest();
|
||||||
|
|
||||||
$CFG->theme = 'clean';
|
$CFG->theme = 'classic';
|
||||||
$executable = new admin_setting_configexecutable('test1', 'Text 1', 'Help Path', '');
|
$executable = new admin_setting_configexecutable('test1', 'Text 1', 'Help Path', '');
|
||||||
|
|
||||||
// Check for an invalid path.
|
// Check for an invalid path.
|
||||||
$result = $executable->output_html($CFG->dirroot . '/lib/tests/other/file_does_not_exist');
|
$result = $executable->output_html($CFG->dirroot . '/lib/tests/other/file_does_not_exist');
|
||||||
$this->assertRegexp('/class="patherror"/', $result);
|
$this->assertRegexp('/class="text-danger"/', $result);
|
||||||
|
|
||||||
// Check for a directory.
|
// Check for a directory.
|
||||||
$result = $executable->output_html($CFG->dirroot);
|
$result = $executable->output_html($CFG->dirroot);
|
||||||
$this->assertRegexp('/class="patherror"/', $result);
|
$this->assertRegexp('/class="text-danger"/', $result);
|
||||||
|
|
||||||
// Check for a file which is not executable.
|
// Check for a file which is not executable.
|
||||||
$result = $executable->output_html($CFG->dirroot . '/filter/tex/readme_moodle.txt');
|
$result = $executable->output_html($CFG->dirroot . '/filter/tex/readme_moodle.txt');
|
||||||
$this->assertRegexp('/class="patherror"/', $result);
|
$this->assertRegexp('/class="text-danger"/', $result);
|
||||||
|
|
||||||
// Check for an executable file.
|
// Check for an executable file.
|
||||||
if ($CFG->ostype == 'WINDOWS') {
|
if ($CFG->ostype == 'WINDOWS') {
|
||||||
@@ -177,7 +177,7 @@ class core_admintree_testcase extends advanced_testcase {
|
|||||||
$filetocheck = 'mimetex.darwin';
|
$filetocheck = 'mimetex.darwin';
|
||||||
}
|
}
|
||||||
$result = $executable->output_html($CFG->dirroot . '/filter/tex/' . $filetocheck);
|
$result = $executable->output_html($CFG->dirroot . '/filter/tex/' . $filetocheck);
|
||||||
$this->assertRegexp('/class="pathok"/', $result);
|
$this->assertRegexp('/class="text-success"/', $result);
|
||||||
|
|
||||||
// Check for no file specified.
|
// Check for no file specified.
|
||||||
$result = $executable->output_html('');
|
$result = $executable->output_html('');
|
||||||
|
@@ -607,7 +607,7 @@ class core_blocklib_testcase extends advanced_testcase {
|
|||||||
|
|
||||||
$PAGE->reset_theme_and_output();
|
$PAGE->reset_theme_and_output();
|
||||||
// Change to a theme with undeletable blocks.
|
// Change to a theme with undeletable blocks.
|
||||||
$CFG->theme = 'clean';
|
$CFG->theme = 'classic';
|
||||||
|
|
||||||
list($page, $blockmanager) = $this->get_a_page_and_block_manager(array($regionname),
|
list($page, $blockmanager) = $this->get_a_page_and_block_manager(array($regionname),
|
||||||
$context, 'page-type');
|
$context, 'page-type');
|
||||||
|
@@ -558,23 +558,23 @@ class core_formslib_testcase extends advanced_testcase {
|
|||||||
global $CFG;
|
global $CFG;
|
||||||
$this->resetAfterTest(true);
|
$this->resetAfterTest(true);
|
||||||
|
|
||||||
$CFG->theme = 'clean';
|
$CFG->theme = 'classic';
|
||||||
$form = new formslib_multiple_modgrade_form();
|
$form = new formslib_multiple_modgrade_form();
|
||||||
ob_start();
|
ob_start();
|
||||||
$form->display();
|
$form->display();
|
||||||
$html = ob_get_clean();
|
$html = ob_get_clean();
|
||||||
|
|
||||||
$this->assertTag(array('id' => 'fgroup_id_grade1'), $html);
|
$this->assertTag(array('id' => 'fitem_fgroup_id_grade1'), $html);
|
||||||
$this->assertTag(array('id' => 'id_grade1_modgrade_type'), $html);
|
$this->assertTag(array('id' => 'id_grade1_modgrade_type'), $html);
|
||||||
$this->assertTag(array('id' => 'id_grade1_modgrade_point'), $html);
|
$this->assertTag(array('id' => 'id_grade1_modgrade_point'), $html);
|
||||||
$this->assertTag(array('id' => 'id_grade1_modgrade_scale'), $html);
|
$this->assertTag(array('id' => 'id_grade1_modgrade_scale'), $html);
|
||||||
|
|
||||||
$this->assertTag(array('id' => 'fgroup_id_grade2'), $html);
|
$this->assertTag(array('id' => 'fitem_fgroup_id_grade2'), $html);
|
||||||
$this->assertTag(array('id' => 'id_grade2_modgrade_type'), $html);
|
$this->assertTag(array('id' => 'id_grade2_modgrade_type'), $html);
|
||||||
$this->assertTag(array('id' => 'id_grade2_modgrade_point'), $html);
|
$this->assertTag(array('id' => 'id_grade2_modgrade_point'), $html);
|
||||||
$this->assertTag(array('id' => 'id_grade2_modgrade_scale'), $html);
|
$this->assertTag(array('id' => 'id_grade2_modgrade_scale'), $html);
|
||||||
|
|
||||||
$this->assertTag(array('id' => 'fgroup_id_grade_3'), $html);
|
$this->assertTag(array('id' => 'fitem_fgroup_id_grade_3'), $html);
|
||||||
$this->assertTag(array('id' => 'id_grade_3_modgrade_type'), $html);
|
$this->assertTag(array('id' => 'id_grade_3_modgrade_type'), $html);
|
||||||
$this->assertTag(array('id' => 'id_grade_3_modgrade_point'), $html);
|
$this->assertTag(array('id' => 'id_grade_3_modgrade_point'), $html);
|
||||||
$this->assertTag(array('id' => 'id_grade_3_modgrade_scale'), $html);
|
$this->assertTag(array('id' => 'id_grade_3_modgrade_scale'), $html);
|
||||||
@@ -586,7 +586,7 @@ class core_formslib_testcase extends advanced_testcase {
|
|||||||
public function test_persistantrreeze_element() {
|
public function test_persistantrreeze_element() {
|
||||||
global $CFG;
|
global $CFG;
|
||||||
$this->resetAfterTest(true);
|
$this->resetAfterTest(true);
|
||||||
$CFG->theme = 'clean';
|
$CFG->theme = 'classic';
|
||||||
|
|
||||||
$form = new formslib_persistantrreeze_element();
|
$form = new formslib_persistantrreeze_element();
|
||||||
ob_start();
|
ob_start();
|
||||||
@@ -595,15 +595,12 @@ class core_formslib_testcase extends advanced_testcase {
|
|||||||
|
|
||||||
// Test advcheckbox id's.
|
// Test advcheckbox id's.
|
||||||
$this->assertTag(array('id' => 'id_advcheckboxpersistant'), $html);
|
$this->assertTag(array('id' => 'id_advcheckboxpersistant'), $html);
|
||||||
$this->assertTag(array('id' => 'id_advcheckboxpersistant_persistant'), $html);
|
|
||||||
$this->assertTag(array('id' => 'id_advcheckboxnotpersistant'), $html);
|
$this->assertTag(array('id' => 'id_advcheckboxnotpersistant'), $html);
|
||||||
$this->assertNotTag(array('id' => 'id_advcheckboxnotpersistant_persistant'), $html);
|
$this->assertNotTag(array('id' => 'id_advcheckboxnotpersistant_persistant'), $html);
|
||||||
$this->assertTag(array('id' => 'id_advcheckboxfrozen'), $html);
|
$this->assertTag(array('id' => 'id_advcheckboxfrozen'), $html);
|
||||||
$this->assertTag(array('id' => 'id_advcheckboxfrozen_persistant'), $html);
|
|
||||||
|
|
||||||
// Check text element id's.
|
// Check text element id's.
|
||||||
$this->assertTag(array('id' => 'id_textpersistant'), $html);
|
$this->assertTag(array('id' => 'id_textpersistant'), $html);
|
||||||
$this->assertTag(array('id' => 'id_textpersistant_persistant'), $html);
|
|
||||||
$this->assertTag(array('id' => 'id_textnotpersistant'), $html);
|
$this->assertTag(array('id' => 'id_textnotpersistant'), $html);
|
||||||
$this->assertNotTag(array('id' => 'id_textnotpersistant_persistant'), $html);
|
$this->assertNotTag(array('id' => 'id_textnotpersistant_persistant'), $html);
|
||||||
$this->assertTag(array('id' => 'id_textfrozen'), $html);
|
$this->assertTag(array('id' => 'id_textfrozen'), $html);
|
||||||
|
@@ -733,41 +733,41 @@ class core_moodle_page_testcase extends advanced_testcase {
|
|||||||
'usertheme' => '',
|
'usertheme' => '',
|
||||||
'sitetheme' => 'boost',
|
'sitetheme' => 'boost',
|
||||||
'cohorts' => [
|
'cohorts' => [
|
||||||
'clean',
|
'classic',
|
||||||
],
|
],
|
||||||
'expected' => 'clean',
|
'expected' => 'classic',
|
||||||
],
|
],
|
||||||
'User member of one cohort which has a theme set, and one without a theme' => [
|
'User member of one cohort which has a theme set, and one without a theme' => [
|
||||||
'usertheme' => '',
|
'usertheme' => '',
|
||||||
'sitetheme' => 'boost',
|
'sitetheme' => 'boost',
|
||||||
'cohorts' => [
|
'cohorts' => [
|
||||||
'clean',
|
'classic',
|
||||||
'',
|
'',
|
||||||
],
|
],
|
||||||
'expected' => 'clean',
|
'expected' => 'classic',
|
||||||
],
|
],
|
||||||
'User member of one cohort which has a theme set, and one with a different theme' => [
|
'User member of one cohort which has a theme set, and one with a different theme' => [
|
||||||
'usertheme' => '',
|
'usertheme' => '',
|
||||||
'sitetheme' => 'boost',
|
'sitetheme' => 'boost',
|
||||||
'cohorts' => [
|
'cohorts' => [
|
||||||
'clean',
|
'classic',
|
||||||
'someother',
|
'someother',
|
||||||
],
|
],
|
||||||
'expected' => 'boost',
|
'expected' => 'boost',
|
||||||
],
|
],
|
||||||
'User with a theme but not a member of any cohort' => [
|
'User with a theme but not a member of any cohort' => [
|
||||||
'usertheme' => 'more',
|
'usertheme' => 'classic',
|
||||||
'sitetheme' => 'boost',
|
'sitetheme' => 'boost',
|
||||||
'cohorts' => [],
|
'cohorts' => [],
|
||||||
'expected' => 'more',
|
'expected' => 'classic',
|
||||||
],
|
],
|
||||||
'User with a theme and member of one cohort which has a theme set' => [
|
'User with a theme and member of one cohort which has a theme set' => [
|
||||||
'usertheme' => 'more',
|
'usertheme' => 'classic',
|
||||||
'sitetheme' => 'boost',
|
'sitetheme' => 'boost',
|
||||||
'cohorts' => [
|
'cohorts' => [
|
||||||
'clean',
|
'boost',
|
||||||
],
|
],
|
||||||
'expected' => 'more',
|
'expected' => 'classic',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@@ -37,33 +37,33 @@ class core_output_mustache_template_finder_testcase extends advanced_testcase {
|
|||||||
global $CFG;
|
global $CFG;
|
||||||
|
|
||||||
// Test a plugin.
|
// Test a plugin.
|
||||||
$dirs = mustache_template_finder::get_template_directories_for_component('mod_assign', 'clean');
|
$dirs = mustache_template_finder::get_template_directories_for_component('mod_assign', 'classic');
|
||||||
|
|
||||||
$correct = array(
|
$correct = array(
|
||||||
'theme/clean/templates/mod_assign/',
|
'theme/classic/templates/mod_assign/',
|
||||||
'theme/bootstrapbase/templates/mod_assign/',
|
'theme/boost/templates/mod_assign/',
|
||||||
'mod/assign/templates/'
|
'mod/assign/templates/'
|
||||||
);
|
);
|
||||||
foreach ($dirs as $index => $dir) {
|
foreach ($dirs as $index => $dir) {
|
||||||
$this->assertSame($dir, $CFG->dirroot . '/' . $correct[$index]);
|
$this->assertSame($dir, $CFG->dirroot . '/' . $correct[$index]);
|
||||||
}
|
}
|
||||||
// Test a subsystem.
|
// Test a subsystem.
|
||||||
$dirs = mustache_template_finder::get_template_directories_for_component('core_user', 'clean');
|
$dirs = mustache_template_finder::get_template_directories_for_component('core_user', 'classic');
|
||||||
|
|
||||||
$correct = array(
|
$correct = array(
|
||||||
'theme/clean/templates/core_user/',
|
'theme/classic/templates/core_user/',
|
||||||
'theme/bootstrapbase/templates/core_user/',
|
'theme/boost/templates/core_user/',
|
||||||
'user/templates/'
|
'user/templates/'
|
||||||
);
|
);
|
||||||
foreach ($dirs as $index => $dir) {
|
foreach ($dirs as $index => $dir) {
|
||||||
$this->assertSame($dir, $CFG->dirroot . '/' . $correct[$index]);
|
$this->assertSame($dir, $CFG->dirroot . '/' . $correct[$index]);
|
||||||
}
|
}
|
||||||
// Test core.
|
// Test core.
|
||||||
$dirs = mustache_template_finder::get_template_directories_for_component('core', 'clean');
|
$dirs = mustache_template_finder::get_template_directories_for_component('core', 'classic');
|
||||||
|
|
||||||
$correct = array(
|
$correct = array(
|
||||||
'theme/clean/templates/core/',
|
'theme/classic/templates/core/',
|
||||||
'theme/bootstrapbase/templates/core/',
|
'theme/boost/templates/core/',
|
||||||
'lib/templates/'
|
'lib/templates/'
|
||||||
);
|
);
|
||||||
foreach ($dirs as $index => $dir) {
|
foreach ($dirs as $index => $dir) {
|
||||||
@@ -77,13 +77,13 @@ class core_output_mustache_template_finder_testcase extends advanced_testcase {
|
|||||||
*/
|
*/
|
||||||
public function test_invalid_get_template_directories_for_component() {
|
public function test_invalid_get_template_directories_for_component() {
|
||||||
// Test something invalid.
|
// Test something invalid.
|
||||||
$dirs = mustache_template_finder::get_template_directories_for_component('octopus', 'clean');
|
$dirs = mustache_template_finder::get_template_directories_for_component('octopus', 'classic');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_get_template_filepath() {
|
public function test_get_template_filepath() {
|
||||||
global $CFG;
|
global $CFG;
|
||||||
|
|
||||||
$filename = mustache_template_finder::get_template_filepath('core/pix_icon', 'clean');
|
$filename = mustache_template_finder::get_template_filepath('core/pix_icon', 'classic');
|
||||||
$correct = $CFG->dirroot . '/lib/templates/pix_icon.mustache';
|
$correct = $CFG->dirroot . '/lib/templates/pix_icon.mustache';
|
||||||
$this->assertSame($correct, $filename);
|
$this->assertSame($correct, $filename);
|
||||||
}
|
}
|
||||||
@@ -93,6 +93,6 @@ class core_output_mustache_template_finder_testcase extends advanced_testcase {
|
|||||||
*/
|
*/
|
||||||
public function test_invalid_get_template_filepath() {
|
public function test_invalid_get_template_filepath() {
|
||||||
// Test something invalid.
|
// Test something invalid.
|
||||||
$dirs = mustache_template_finder::get_template_filepath('core/octopus', 'clean');
|
$dirs = mustache_template_finder::get_template_filepath('core/octopus', 'classic');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -268,7 +268,7 @@ class core_outputcomponents_testcase extends advanced_testcase {
|
|||||||
// $this->assertSame($CFG->wwwroot.'/theme/image.php/formal_white/core/1/u/f2', $up2->get_url($page, $renderer)->out(false));
|
// $this->assertSame($CFG->wwwroot.'/theme/image.php/formal_white/core/1/u/f2', $up2->get_url($page, $renderer)->out(false));
|
||||||
|
|
||||||
// Test non-slashargument images.
|
// Test non-slashargument images.
|
||||||
set_config('theme', 'clean');
|
set_config('theme', 'classic');
|
||||||
$CFG->wwwroot = str_replace('https:', 'http:', $CFG->wwwroot);
|
$CFG->wwwroot = str_replace('https:', 'http:', $CFG->wwwroot);
|
||||||
$CFG->slasharguments = 0;
|
$CFG->slasharguments = 0;
|
||||||
$page = new moodle_page();
|
$page = new moodle_page();
|
||||||
@@ -277,7 +277,7 @@ class core_outputcomponents_testcase extends advanced_testcase {
|
|||||||
$renderer = $page->get_renderer('core');
|
$renderer = $page->get_renderer('core');
|
||||||
|
|
||||||
$up3 = new user_picture($user3);
|
$up3 = new user_picture($user3);
|
||||||
$this->assertSame($CFG->wwwroot.'/theme/image.php?theme=clean&component=core&rev=1&image=u%2Ff2', $up3->get_url($page, $renderer)->out(false));
|
$this->assertSame($CFG->wwwroot.'/theme/image.php?theme=classic&component=core&rev=1&image=u%2Ff2', $up3->get_url($page, $renderer)->out(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_empty_menu() {
|
public function test_empty_menu() {
|
||||||
@@ -454,7 +454,7 @@ EOF;
|
|||||||
$this->assertNotContains('aria-hidden="true"', $renderer->pix_icon('t/print', 'Print'), $reason);
|
$this->assertNotContains('aria-hidden="true"', $renderer->pix_icon('t/print', 'Print'), $reason);
|
||||||
|
|
||||||
// Test another theme with a different icon system.
|
// Test another theme with a different icon system.
|
||||||
set_config('theme', 'clean');
|
set_config('theme', 'classic');
|
||||||
// Need to reset after changing theme.
|
// Need to reset after changing theme.
|
||||||
$page->reset_theme_and_output();
|
$page->reset_theme_and_output();
|
||||||
$renderer = $page->get_renderer('core');
|
$renderer = $page->get_renderer('core');
|
||||||
|
@@ -794,8 +794,7 @@ class core_upgradelib_testcase extends advanced_testcase {
|
|||||||
$CFG->themedir = $this->create_testthemes();
|
$CFG->themedir = $this->create_testthemes();
|
||||||
|
|
||||||
$this->assertSame($CFG->dirroot . '/theme/boost', upgrade_find_theme_location('boost'));
|
$this->assertSame($CFG->dirroot . '/theme/boost', upgrade_find_theme_location('boost'));
|
||||||
$this->assertSame($CFG->dirroot . '/theme/clean', upgrade_find_theme_location('clean'));
|
$this->assertSame($CFG->dirroot . '/theme/classic', upgrade_find_theme_location('classic'));
|
||||||
$this->assertSame($CFG->dirroot . '/theme/bootstrapbase', upgrade_find_theme_location('bootstrapbase'));
|
|
||||||
|
|
||||||
$this->assertSame($CFG->themedir . '/testtheme', upgrade_find_theme_location('testtheme'));
|
$this->assertSame($CFG->themedir . '/testtheme', upgrade_find_theme_location('testtheme'));
|
||||||
$this->assertSame($CFG->themedir . '/childoftesttheme', upgrade_find_theme_location('childoftesttheme'));
|
$this->assertSame($CFG->themedir . '/childoftesttheme', upgrade_find_theme_location('childoftesttheme'));
|
||||||
@@ -812,8 +811,8 @@ class core_upgradelib_testcase extends advanced_testcase {
|
|||||||
$CFG->themedir = $this->create_testthemes();
|
$CFG->themedir = $this->create_testthemes();
|
||||||
|
|
||||||
$this->assertTrue(upgrade_theme_is_from_family('boost', 'boost'), 'Boost is a boost theme');
|
$this->assertTrue(upgrade_theme_is_from_family('boost', 'boost'), 'Boost is a boost theme');
|
||||||
$this->assertTrue(upgrade_theme_is_from_family('bootstrapbase', 'clean'), 'Clean is a bootstrap base theme');
|
$this->assertTrue(upgrade_theme_is_from_family('boost', 'classic'), 'Classic is a boost base theme');
|
||||||
$this->assertFalse(upgrade_theme_is_from_family('boost', 'clean'), 'Clean is not a boost theme');
|
$this->assertFalse(upgrade_theme_is_from_family('classic', 'boost'), 'Boost is not a classic theme');
|
||||||
|
|
||||||
$this->assertTrue(upgrade_theme_is_from_family('testtheme', 'childoftesttheme'), 'childoftesttheme is a testtheme');
|
$this->assertTrue(upgrade_theme_is_from_family('testtheme', 'childoftesttheme'), 'childoftesttheme is a testtheme');
|
||||||
$this->assertFalse(upgrade_theme_is_from_family('testtheme', 'orphantheme'), 'ofphantheme is not a testtheme');
|
$this->assertFalse(upgrade_theme_is_from_family('testtheme', 'orphantheme'), 'ofphantheme is not a testtheme');
|
||||||
|
@@ -85,7 +85,7 @@ test
|
|||||||
// Test using an admin user at the root of Moodle; this way we don't have to create a test user with avatar.
|
// Test using an admin user at the root of Moodle; this way we don't have to create a test user with avatar.
|
||||||
$this->setAdminUser();
|
$this->setAdminUser();
|
||||||
$PAGE->set_url('/');
|
$PAGE->set_url('/');
|
||||||
$CFG->theme = 'clean';
|
$CFG->theme = 'classic';
|
||||||
$PAGE->reset_theme_and_output();
|
$PAGE->reset_theme_and_output();
|
||||||
$PAGE->initialise_theme_and_output();
|
$PAGE->initialise_theme_and_output();
|
||||||
|
|
||||||
|
@@ -658,8 +658,8 @@ class core_user_testcase extends advanced_testcase {
|
|||||||
|
|
||||||
// Test against theme property choices.
|
// Test against theme property choices.
|
||||||
$choices = core_user::get_property_choices('theme');
|
$choices = core_user::get_property_choices('theme');
|
||||||
$this->assertArrayHasKey('bootstrapbase', $choices);
|
$this->assertArrayHasKey('boost', $choices);
|
||||||
$this->assertArrayHasKey('clean', $choices);
|
$this->assertArrayHasKey('classic', $choices);
|
||||||
$this->assertArrayNotHasKey('unknowntheme', $choices);
|
$this->assertArrayNotHasKey('unknowntheme', $choices);
|
||||||
$this->assertArrayNotHasKey('wrongtheme', $choices);
|
$this->assertArrayNotHasKey('wrongtheme', $choices);
|
||||||
|
|
||||||
|
@@ -147,7 +147,7 @@ class core_userliblib_testcase extends advanced_testcase {
|
|||||||
$user->auth = 'shibboleth';
|
$user->auth = 'shibboleth';
|
||||||
$user->country = 'AU';
|
$user->country = 'AU';
|
||||||
$user->lang = 'en';
|
$user->lang = 'en';
|
||||||
$user->theme = 'clean';
|
$user->theme = 'classic';
|
||||||
$user->timezone = 'Australia/Perth';
|
$user->timezone = 'Australia/Perth';
|
||||||
$user->url = 'www.moodle.org';
|
$user->url = 'www.moodle.org';
|
||||||
user_update_user($user, true, false);
|
user_update_user($user, true, false);
|
||||||
@@ -234,7 +234,7 @@ class core_userliblib_testcase extends advanced_testcase {
|
|||||||
$user['auth'] = 'shibboleth';
|
$user['auth'] = 'shibboleth';
|
||||||
$user['country'] = 'AU';
|
$user['country'] = 'AU';
|
||||||
$user['lang'] = 'en';
|
$user['lang'] = 'en';
|
||||||
$user['theme'] = 'clean';
|
$user['theme'] = 'classic';
|
||||||
$user['timezone'] = 'Australia/Perth';
|
$user['timezone'] = 'Australia/Perth';
|
||||||
$user['url'] = 'www.moodle.org';
|
$user['url'] = 'www.moodle.org';
|
||||||
user_create_user($user, true, false);
|
user_create_user($user, true, false);
|
||||||
|
@@ -54,7 +54,7 @@ class core_webservice_externallib_testcase extends externallib_advanced_testcase
|
|||||||
$user['username'] = 'johnd';
|
$user['username'] = 'johnd';
|
||||||
$user['firstname'] = 'John';
|
$user['firstname'] = 'John';
|
||||||
$user['lastname'] = 'Doe';
|
$user['lastname'] = 'Doe';
|
||||||
$user['theme'] = 'more';
|
$user['theme'] = 'boost';
|
||||||
self::setUser(self::getDataGenerator()->create_user($user));
|
self::setUser(self::getDataGenerator()->create_user($user));
|
||||||
|
|
||||||
// Add a web service and token.
|
// Add a web service and token.
|
||||||
|
Reference in New Issue
Block a user