Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
e00f1c66
Commit
e00f1c66
authored
Feb 28, 2019
by
Mathew May
Browse files
MDL-64506 phpunit: Update unit tests to use classic
parent
c8edee42
Changes
23
Hide whitespace changes
Inline
Side-by-side
admin/cli/cfg.php
View file @
e00f1c66
...
...
@@ -83,7 +83,7 @@ Examples:
Stores the given configuration variable in the shell variable, escaped
so that it can be safely used as a shell argument.
# php cfg.php --name=theme --set=cl
ean
# php cfg.php --name=theme --set=cl
assic
Sets the given configuration variable to the given value.
# php cfg.php --name=noemailever --unset
...
...
admin/tool/cohortroles/templates/cohort-in-list.mustache
View file @
e00f1c66
...
...
@@ -39,7 +39,7 @@
"visible"
:
true
,
"idnumber"
:
"014"
,
"description"
:
"Some users"
,
"theme"
:
"cl
ean
"
"theme"
:
"cl
assic
"
}
}}
{{>
tool_lp
/
form-cohort-selector-suggestion
}}
admin/tool/uploadcourse/tests/course_test.php
View file @
e00f1c66
...
...
@@ -403,7 +403,7 @@ class tool_uploadcourse_course_testcase extends advanced_testcase {
'idnumber'
=>
'changeidn'
,
'summary'
=>
'Summary 2'
,
'format'
=>
'topics'
,
'theme'
=>
'cl
ean
'
,
'theme'
=>
'cl
assic
'
,
'lang'
=>
''
,
'newsitems'
=>
'2'
,
'showgrades'
=>
'1'
,
...
...
@@ -566,7 +566,7 @@ class tool_uploadcourse_course_testcase extends advanced_testcase {
'idnumber'
=>
'changedid'
,
'summary'
=>
'Summary 2'
,
'format'
=>
'topics'
,
'theme'
=>
'cl
ean
'
,
'theme'
=>
'cl
assic
'
,
'lang'
=>
''
,
'newsitems'
=>
'2'
,
'showgrades'
=>
'1'
,
...
...
admin/tool/usertours/tests/theme_filter_test.php
View file @
e00f1c66
...
...
@@ -56,17 +56,17 @@ class tool_usertours_theme_filter_testcase extends advanced_testcase {
true
,
],
'Multiple values set including matching; Matches'
=>
[
[
'boost'
,
'cl
ean
'
],
[
'boost'
,
'cl
assic
'
],
'boost'
,
true
,
],
'Single value set; No match'
=>
[
[
'cl
ean
'
],
[
'cl
assic
'
],
'boost'
,
false
,
],
'Multiple values set; No match'
=>
[
[
'cl
ean
'
,
'artificial'
],
[
'cl
assic
'
,
'artificial'
],
'boost'
,
false
,
],
...
...
cohort/tests/behat/upload_cohorts.feature
View file @
e00f1c66
...
...
@@ -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 click on
"Preview"
"button"
Then the following should exist in the "previewuploadedcohorts" table
:
|
name
|
idnumber
|
description
|
Context
|
visible
|
theme
|
Status
|
|
cohort
name
1
|
cohortid1
|
first
description
|
System
|
1
|
boost
|
|
|
cohort
name
2
|
cohortid2
|
|
System
|
1
|
|
|
|
cohort
name
3
|
cohortid3
|
|
Miscellaneous
|
0
|
boost
|
|
|
cohort
name
4
|
cohortid4
|
|
Cat
1
|
1
|
cl
ean
|
|
|
cohort
name
5
|
cohortid5
|
|
Cat
2
|
0
|
|
|
|
cohort
name
6
|
cohortid6
|
|
Cat
3
|
1
|
cl
ean
|
|
|
name
|
idnumber
|
description
|
Context
|
visible
|
theme
|
Status
|
|
cohort
name
1
|
cohortid1
|
first
description
|
System
|
1
|
boost
|
|
|
cohort
name
2
|
cohortid2
|
|
System
|
1
|
|
|
|
cohort
name
3
|
cohortid3
|
|
Miscellaneous
|
0
|
boost
|
|
|
cohort
name
4
|
cohortid4
|
|
Cat
1
|
1
|
cl
assic
|
|
|
cohort
name
5
|
cohortid5
|
|
Cat
2
|
0
|
|
|
|
cohort
name
6
|
cohortid6
|
|
Cat
3
|
1
|
cl
assic
|
|
And
I press
"Upload cohorts"
And
I should see
"Uploaded 6 cohorts"
And
I press
"Continue"
...
...
cohort/tests/cohortlib_test.php
View file @
e00f1c66
...
...
@@ -671,7 +671,7 @@ class core_cohort_cohortlib_testcase extends advanced_testcase {
$systemctx
=
context_system
::
instance
();
$cohort1
=
$this
->
getDataGenerator
()
->
create_cohort
(
array
(
'contextid'
=>
$systemctx
->
id
,
'name'
=>
'test cohort 1'
,
'idnumber'
=>
'testid1'
,
'description'
=>
'test cohort desc'
,
'descriptionformat'
=>
FORMAT_HTML
,
'theme'
=>
'cl
ean
'
));
'idnumber'
=>
'testid1'
,
'description'
=>
'test cohort desc'
,
'descriptionformat'
=>
FORMAT_HTML
,
'theme'
=>
'cl
assic
'
));
$id
=
cohort_add_cohort
(
$cohort1
);
$this
->
assertNotEmpty
(
$id
);
...
...
@@ -690,7 +690,7 @@ class core_cohort_cohortlib_testcase extends advanced_testcase {
set_config
(
'allowcohortthemes'
,
0
);
$cohort2
=
$this
->
getDataGenerator
()
->
create_cohort
(
array
(
'contextid'
=>
$systemctx
->
id
,
'name'
=>
'test cohort 2'
,
'idnumber'
=>
'testid2'
,
'description'
=>
'test cohort desc'
,
'descriptionformat'
=>
FORMAT_HTML
,
'theme'
=>
'cl
ean
'
));
'idnumber'
=>
'testid2'
,
'description'
=>
'test cohort desc'
,
'descriptionformat'
=>
FORMAT_HTML
,
'theme'
=>
'cl
assic
'
));
$id
=
cohort_add_cohort
(
$cohort2
);
$this
->
assertNotEmpty
(
$id
);
...
...
@@ -713,14 +713,14 @@ class core_cohort_cohortlib_testcase extends advanced_testcase {
$systemctx
=
context_system
::
instance
();
$cohort1
=
$this
->
getDataGenerator
()
->
create_cohort
(
array
(
'contextid'
=>
$systemctx
->
id
,
'name'
=>
'test cohort 1'
,
'idnumber'
=>
'testid1'
,
'description'
=>
'test cohort desc'
,
'descriptionformat'
=>
FORMAT_HTML
,
'theme'
=>
'cl
ean
'
));
'idnumber'
=>
'testid1'
,
'description'
=>
'test cohort desc'
,
'descriptionformat'
=>
FORMAT_HTML
,
'theme'
=>
'cl
assic
'
));
$id
=
cohort_add_cohort
(
$cohort1
);
$this
->
assertNotEmpty
(
$id
);
// Theme is updated when allowcohortthemes is enabled.
$cohort1
=
$DB
->
get_record
(
'cohort'
,
array
(
'id'
=>
$id
));
$cohort1
->
name
=
'test cohort 1 updated'
;
$cohort1
->
theme
=
'
more
'
;
$cohort1
->
theme
=
'
classic
'
;
cohort_update_cohort
(
$cohort1
);
$updatedcohort
=
$DB
->
get_record
(
'cohort'
,
array
(
'id'
=>
$id
));
$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.
set_config
(
'allowcohortthemes'
,
0
);
$cohort2
=
$DB
->
get_record
(
'cohort'
,
array
(
'id'
=>
$id
));
$cohort2
->
theme
=
'cl
ean
'
;
$cohort2
->
theme
=
'cl
assic
'
;
cohort_update_cohort
(
$cohort2
);
$updatedcohort
=
$DB
->
get_record
(
'cohort'
,
array
(
'id'
=>
$id
));
$this
->
assertEquals
(
$cohort2
->
contextid
,
$updatedcohort
->
contextid
);
...
...
cohort/tests/externallib_test.php
View file @
e00f1c66
...
...
@@ -52,7 +52,7 @@ class core_cohort_externallib_testcase extends externallib_advanced_testcase {
'name'
=>
'cohort test 1'
,
'idnumber'
=>
'cohorttest1'
,
'description'
=>
'This is a description for cohorttest1'
,
'theme'
=>
'cl
ean
'
'theme'
=>
'cl
assic
'
);
$cohort2
=
array
(
...
...
@@ -76,7 +76,7 @@ class core_cohort_externallib_testcase extends externallib_advanced_testcase {
'name'
=>
'cohort test 4'
,
'idnumber'
=>
'cohorttest4'
,
'description'
=>
'This is a description for cohorttest4'
,
'theme'
=>
'cl
ean
'
'theme'
=>
'cl
assic
'
);
// Call the external function.
...
...
@@ -182,7 +182,7 @@ class core_cohort_externallib_testcase extends externallib_advanced_testcase {
'name'
=>
'cohortnametest1'
,
'idnumber'
=>
'idnumbertest1'
,
'description'
=>
'This is a description for cohort 1'
,
'theme'
=>
'cl
ean
'
'theme'
=>
'cl
assic
'
);
$cohort1
=
self
::
getDataGenerator
()
->
create_cohort
(
$cohort1
);
$cohort2
=
self
::
getDataGenerator
()
->
create_cohort
();
...
...
@@ -250,7 +250,7 @@ class core_cohort_externallib_testcase extends externallib_advanced_testcase {
'name'
=>
'cohortnametest1'
,
'idnumber'
=>
'idnumbertest1'
,
'description'
=>
'This is a description for cohort 1'
,
'theme'
=>
'cl
ean
'
'theme'
=>
'cl
assic
'
);
$context
=
context_system
::
instance
();
...
...
@@ -279,15 +279,15 @@ class core_cohort_externallib_testcase extends externallib_advanced_testcase {
// Call when $CFG->allowcohortthemes is enabled.
set_config
(
'allowcohortthemes'
,
1
);
core_cohort_external
::
update_cohorts
(
array
(
$cohort1
+
array
(
'theme'
=>
'cl
ean
'
)));
core_cohort_external
::
update_cohorts
(
array
(
$cohort1
+
array
(
'theme'
=>
'cl
assic
'
)));
$dbcohort
=
$DB
->
get_record
(
'cohort'
,
array
(
'id'
=>
$cohort1
[
'id'
]));
$this
->
assertEquals
(
'cl
ean
'
,
$dbcohort
->
theme
);
$this
->
assertEquals
(
'cl
assic
'
,
$dbcohort
->
theme
);
// Call when $CFG->allowcohortthemes is disabled.
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'
]));
$this
->
assertEquals
(
'cl
ean
'
,
$dbcohort
->
theme
);
$this
->
assertEquals
(
'cl
assic
'
,
$dbcohort
->
theme
);
// Call without required capability.
$this
->
unassignUserCapability
(
'moodle/cohort:manage'
,
$context
->
id
,
$roleid
);
...
...
cohort/tests/fixtures/uploadcohorts4.csv
View file @
e00f1c66
...
...
@@ -2,6 +2,6 @@ name,idnumber,description,category,visible,theme
cohort name 1,cohortid1,first description,,,boost
cohort name 2,cohortid2,,,,
cohort name 3,cohortid3,,Miscellaneous,no,boost
cohort name 4,cohortid4,,CAT1,yes,cl
ean
cohort name 4,cohortid4,,CAT1,yes,cl
assic
cohort name 5,cohortid5,,CAT2,0,
cohort name 6,cohortid6,,CAT3,1,cl
ean
cohort name 6,cohortid6,,CAT3,1,cl
assic
course/tests/externallib_test.php
View file @
e00f1c66
...
...
@@ -67,7 +67,7 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
$category2
->
name
=
'Root Test Category 2'
;
$category2
->
idnumber
=
'rootcattest2'
;
$category2
->
desc
=
'Description for root test category 1'
;
$category2
->
theme
=
'
bootstrapbase
'
;
$category2
->
theme
=
'
classic
'
;
$categories
=
array
(
array
(
'name'
=>
$category1
->
name
,
'parent'
=>
0
),
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
[
'completionnotify'
]
=
1
;
$course2
[
'lang'
]
=
'en'
;
$course2
[
'forcetheme'
]
=
'
bootstrapbase
'
;
$course2
[
'forcetheme'
]
=
'
classic
'
;
$course2
[
'courseformatoptions'
][]
=
array
(
'name'
=>
'automaticenddate'
,
'value'
=>
0
);
$course3
[
'fullname'
]
=
'Test course 3'
;
$course3
[
'shortname'
]
=
'Testcourse3'
;
...
...
@@ -1438,7 +1438,7 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
$course2
[
'defaultgroupingid'
]
=
0
;
$course2
[
'enablecompletion'
]
=
1
;
$course2
[
'lang'
]
=
'en'
;
$course2
[
'forcetheme'
]
=
'
bootstrapbase
'
;
$course2
[
'forcetheme'
]
=
'
classic
'
;
$course3
[
'id'
]
=
$originalcourse3
->
id
;
$updatedcustomfieldvalue
=
[
'shortname'
=>
'test'
,
'value'
=>
'Updated test value'
];
...
...
lib/classes/plugin_manager.php
View file @
e00f1c66
...
...
@@ -1654,9 +1654,10 @@ class core_plugin_manager {
'repository'
=>
array
(
'alfresco'
),
'tinymce'
=>
array
(
'dragmath'
),
'tool'
=>
array
(
'bloglevelupgrade'
,
'qeupgradehelper'
,
'timezoneimport'
,
'assignmentupgrade'
),
'theme'
=>
array
(
'afterburner'
,
'anomaly'
,
'arialist'
,
'base'
,
'binarius'
,
'boxxie'
,
'brick'
,
'canvas'
,
'formal_white'
,
'formfactor'
,
'fusion'
,
'leatherbound'
,
'magazine'
,
'mymobile'
,
'nimble'
,
'nonzero'
,
'overlay'
,
'serenity'
,
'sky_high'
,
'splash'
,
'standard'
,
'standardold'
),
'theme'
=>
array
(
'bootstrapbase'
,
'clean'
,
'more'
,
'afterburner'
,
'anomaly'
,
'arialist'
,
'base'
,
'binarius'
,
'boxxie'
,
'brick'
,
'canvas'
,
'formal_white'
,
'formfactor'
,
'fusion'
,
'leatherbound'
,
'magazine'
,
'mymobile'
,
'nimble'
,
'nonzero'
,
'overlay'
,
'serenity'
,
'sky_high'
,
'splash'
,
'standard'
,
'standardold'
),
'webservice'
=>
array
(
'amf'
),
);
...
...
@@ -1905,7 +1906,7 @@ class core_plugin_manager {
),
'theme'
=>
array
(
'boost'
,
'classic'
,
'bootstrapbase'
,
'clean'
,
'more'
'boost'
,
'classic'
),
'tool'
=>
array
(
...
...
lib/classes/plugininfo/theme.php
View file @
e00f1c66
...
...
@@ -34,7 +34,7 @@ class theme extends base {
public
function
is_uninstall_allowed
()
{
global
$CFG
;
if
(
$this
->
name
===
'boo
t
st
rapbase
'
)
{
if
(
$this
->
name
===
'boost'
)
{
// All of these are protected for now.
return
false
;
}
...
...
lib/outputlib.php
View file @
e00f1c66
...
...
@@ -739,11 +739,7 @@ class theme_config {
$this
->
name
=
$config
->
name
;
$this
->
dir
=
$config
->
dir
;
if
(
$this
->
name
!=
'bootstrapbase'
)
{
$baseconfig
=
theme_config
::
find_theme_config
(
'bootstrapbase'
,
$this
->
settings
);
}
else
{
$baseconfig
=
$config
;
}
$baseconfig
=
$config
;
$configurable
=
array
(
'parents'
,
'sheets'
,
'parents_exclude_sheets'
,
'plugins_exclude_sheets'
,
'usefallback'
,
...
...
lib/tests/admintree_test.php
View file @
e00f1c66
...
...
@@ -155,20 +155,20 @@ class core_admintree_testcase extends advanced_testcase {
global
$CFG
;
$this
->
resetAfterTest
();
$CFG
->
theme
=
'cl
ean
'
;
$CFG
->
theme
=
'cl
assic
'
;
$executable
=
new
admin_setting_configexecutable
(
'test1'
,
'Text 1'
,
'Help Path'
,
''
);
// Check for an invalid path.
$result
=
$executable
->
output_html
(
$CFG
->
dirroot
.
'/lib/tests/other/file_does_not_exist'
);
$this
->
assertRegexp
(
'/class="
patherro
r"/'
,
$result
);
$this
->
assertRegexp
(
'/class="
text-dange
r"/'
,
$result
);
// Check for a directory.
$result
=
$executable
->
output_html
(
$CFG
->
dirroot
);
$this
->
assertRegexp
(
'/class="
patherro
r"/'
,
$result
);
$this
->
assertRegexp
(
'/class="
text-dange
r"/'
,
$result
);
// Check for a file which is not executable.
$result
=
$executable
->
output_html
(
$CFG
->
dirroot
.
'/filter/tex/readme_moodle.txt'
);
$this
->
assertRegexp
(
'/class="
patherro
r"/'
,
$result
);
$this
->
assertRegexp
(
'/class="
text-dange
r"/'
,
$result
);
// Check for an executable file.
if
(
$CFG
->
ostype
==
'WINDOWS'
)
{
...
...
@@ -177,7 +177,7 @@ class core_admintree_testcase extends advanced_testcase {
$filetocheck
=
'mimetex.darwin'
;
}
$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.
$result
=
$executable
->
output_html
(
''
);
...
...
lib/tests/blocklib_test.php
View file @
e00f1c66
...
...
@@ -607,7 +607,7 @@ class core_blocklib_testcase extends advanced_testcase {
$PAGE
->
reset_theme_and_output
();
// Change to a theme with undeletable blocks.
$CFG
->
theme
=
'cl
ean
'
;
$CFG
->
theme
=
'cl
assic
'
;
list
(
$page
,
$blockmanager
)
=
$this
->
get_a_page_and_block_manager
(
array
(
$regionname
),
$context
,
'page-type'
);
...
...
lib/tests/formslib_test.php
View file @
e00f1c66
...
...
@@ -558,23 +558,23 @@ class core_formslib_testcase extends advanced_testcase {
global
$CFG
;
$this
->
resetAfterTest
(
true
);
$CFG
->
theme
=
'cl
ean
'
;
$CFG
->
theme
=
'cl
assic
'
;
$form
=
new
formslib_multiple_modgrade_form
();
ob_start
();
$form
->
display
();
$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_point'
),
$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_point'
),
$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_point'
),
$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
()
{
global
$CFG
;
$this
->
resetAfterTest
(
true
);
$CFG
->
theme
=
'cl
ean
'
;
$CFG
->
theme
=
'cl
assic
'
;
$form
=
new
formslib_persistantrreeze_element
();
ob_start
();
...
...
@@ -595,15 +595,12 @@ class core_formslib_testcase extends advanced_testcase {
// Test advcheckbox id's.
$this
->
assertTag
(
array
(
'id'
=>
'id_advcheckboxpersistant'
),
$html
);
$this
->
assertTag
(
array
(
'id'
=>
'id_advcheckboxpersistant_persistant'
),
$html
);
$this
->
assertTag
(
array
(
'id'
=>
'id_advcheckboxnotpersistant'
),
$html
);
$this
->
assertNotTag
(
array
(
'id'
=>
'id_advcheckboxnotpersistant_persistant'
),
$html
);
$this
->
assertTag
(
array
(
'id'
=>
'id_advcheckboxfrozen'
),
$html
);
$this
->
assertTag
(
array
(
'id'
=>
'id_advcheckboxfrozen_persistant'
),
$html
);
// Check text element id's.
$this
->
assertTag
(
array
(
'id'
=>
'id_textpersistant'
),
$html
);
$this
->
assertTag
(
array
(
'id'
=>
'id_textpersistant_persistant'
),
$html
);
$this
->
assertTag
(
array
(
'id'
=>
'id_textnotpersistant'
),
$html
);
$this
->
assertNotTag
(
array
(
'id'
=>
'id_textnotpersistant_persistant'
),
$html
);
$this
->
assertTag
(
array
(
'id'
=>
'id_textfrozen'
),
$html
);
...
...
lib/tests/moodle_page_test.php
View file @
e00f1c66
...
...
@@ -733,41 +733,41 @@ class core_moodle_page_testcase extends advanced_testcase {
'usertheme'
=>
''
,
'sitetheme'
=>
'boost'
,
'cohorts'
=>
[
'cl
ean
'
,
'cl
assic
'
,
],
'expected'
=>
'cl
ean
'
,
'expected'
=>
'cl
assic
'
,
],
'User member of one cohort which has a theme set, and one without a theme'
=>
[
'usertheme'
=>
''
,
'sitetheme'
=>
'boost'
,
'cohorts'
=>
[
'cl
ean
'
,
'cl
assic
'
,
''
,
],
'expected'
=>
'cl
ean
'
,
'expected'
=>
'cl
assic
'
,
],
'User member of one cohort which has a theme set, and one with a different theme'
=>
[
'usertheme'
=>
''
,
'sitetheme'
=>
'boost'
,
'cohorts'
=>
[
'cl
ean
'
,
'cl
assic
'
,
'someother'
,
],
'expected'
=>
'boost'
,
],
'User with a theme but not a member of any cohort'
=>
[
'usertheme'
=>
'
more
'
,
'usertheme'
=>
'
classic
'
,
'sitetheme'
=>
'boost'
,
'cohorts'
=>
[],
'expected'
=>
'
more
'
,
'expected'
=>
'
classic
'
,
],
'User with a theme and member of one cohort which has a theme set'
=>
[
'usertheme'
=>
'
more
'
,
'usertheme'
=>
'
classic
'
,
'sitetheme'
=>
'boost'
,
'cohorts'
=>
[
'
clean
'
,
'
boost
'
,
],
'expected'
=>
'
more
'
,
'expected'
=>
'
classic
'
,
],
];
}
...
...
lib/tests/mustache_template_finder_test.php
View file @
e00f1c66
...
...
@@ -37,33 +37,33 @@ class core_output_mustache_template_finder_testcase extends advanced_testcase {
global
$CFG
;
// Test a plugin.
$dirs
=
mustache_template_finder
::
get_template_directories_for_component
(
'mod_assign'
,
'cl
ean
'
);
$dirs
=
mustache_template_finder
::
get_template_directories_for_component
(
'mod_assign'
,
'cl
assic
'
);
$correct
=
array
(
'theme/cl
ean
/templates/mod_assign/'
,
'theme/boo
t
st
rapbase
/templates/mod_assign/'
,
'theme/cl
assic
/templates/mod_assign/'
,
'theme/boost/templates/mod_assign/'
,
'mod/assign/templates/'
);
foreach
(
$dirs
as
$index
=>
$dir
)
{
$this
->
assertSame
(
$dir
,
$CFG
->
dirroot
.
'/'
.
$correct
[
$index
]);
}
// Test a subsystem.
$dirs
=
mustache_template_finder
::
get_template_directories_for_component
(
'core_user'
,
'cl
ean
'
);
$dirs
=
mustache_template_finder
::
get_template_directories_for_component
(
'core_user'
,
'cl
assic
'
);
$correct
=
array
(
'theme/cl
ean
/templates/core_user/'
,
'theme/boo
t
st
rapbase
/templates/core_user/'
,
'theme/cl
assic
/templates/core_user/'
,
'theme/boost/templates/core_user/'
,
'user/templates/'
);
foreach
(
$dirs
as
$index
=>
$dir
)
{
$this
->
assertSame
(
$dir
,
$CFG
->
dirroot
.
'/'
.
$correct
[
$index
]);
}
// Test core.
$dirs
=
mustache_template_finder
::
get_template_directories_for_component
(
'core'
,
'cl
ean
'
);
$dirs
=
mustache_template_finder
::
get_template_directories_for_component
(
'core'
,
'cl
assic
'
);
$correct
=
array
(
'theme/cl
ean
/templates/core/'
,
'theme/boo
t
st
rapbase
/templates/core/'
,
'theme/cl
assic
/templates/core/'
,
'theme/boost/templates/core/'
,
'lib/templates/'
);
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
()
{
// Test something invalid.
$dirs
=
mustache_template_finder
::
get_template_directories_for_component
(
'octopus'
,
'cl
ean
'
);
$dirs
=
mustache_template_finder
::
get_template_directories_for_component
(
'octopus'
,
'cl
assic
'
);
}
public
function
test_get_template_filepath
()
{
global
$CFG
;
$filename
=
mustache_template_finder
::
get_template_filepath
(
'core/pix_icon'
,
'cl
ean
'
);
$filename
=
mustache_template_finder
::
get_template_filepath
(
'core/pix_icon'
,
'cl
assic
'
);
$correct
=
$CFG
->
dirroot
.
'/lib/templates/pix_icon.mustache'
;
$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
()
{
// Test something invalid.
$dirs
=
mustache_template_finder
::
get_template_filepath
(
'core/octopus'
,
'cl
ean
'
);
$dirs
=
mustache_template_finder
::
get_template_filepath
(
'core/octopus'
,
'cl
assic
'
);
}
}
lib/tests/outputcomponents_test.php
View file @
e00f1c66
...
...
@@ -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));
// Test non-slashargument images.
set_config
(
'theme'
,
'cl
ean
'
);
set_config
(
'theme'
,
'cl
assic
'
);
$CFG
->
wwwroot
=
str_replace
(
'https:'
,
'http:'
,
$CFG
->
wwwroot
);
$CFG
->
slasharguments
=
0
;
$page
=
new
moodle_page
();
...
...
@@ -277,7 +277,7 @@ class core_outputcomponents_testcase extends advanced_testcase {
$renderer
=
$page
->
get_renderer
(
'core'
);
$up3
=
new
user_picture
(
$user3
);
$this
->
assertSame
(
$CFG
->
wwwroot
.
'/theme/image.php?theme=cl
ean
&component=core&rev=1&image=u%2Ff2'
,
$up3
->
get_url
(
$page
,
$renderer
)
->
out
(
false
));
$this
->
assertSame
(
$CFG
->
wwwroot
.
'/theme/image.php?theme=cl
assic
&component=core&rev=1&image=u%2Ff2'
,
$up3
->
get_url
(
$page
,
$renderer
)
->
out
(
false
));
}
public
function
test_empty_menu
()
{
...
...
@@ -454,7 +454,7 @@ EOF;
$this
->
assertNotContains
(
'aria-hidden="true"'
,
$renderer
->
pix_icon
(
't/print'
,
'Print'
),
$reason
);
// Test another theme with a different icon system.
set_config
(
'theme'
,
'cl
ean
'
);
set_config
(
'theme'
,
'cl
assic
'
);
// Need to reset after changing theme.
$page
->
reset_theme_and_output
();
$renderer
=
$page
->
get_renderer
(
'core'
);
...
...
lib/tests/upgradelib_test.php
View file @
e00f1c66
...
...
@@ -794,8 +794,7 @@ class core_upgradelib_testcase extends advanced_testcase {
$CFG
->
themedir
=
$this
->
create_testthemes
();
$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/bootstrapbase'
,
upgrade_find_theme_location
(
'bootstrapbase'
));
$this
->
assertSame
(
$CFG
->
dirroot
.
'/theme/classic'
,
upgrade_find_theme_location
(
'classic'
));
$this
->
assertSame
(
$CFG
->
themedir
.
'/testtheme'
,
upgrade_find_theme_location
(
'testtheme'
));
$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
();
$this
->
assertTrue
(
upgrade_theme_is_from_family
(
'boost'
,
'boost'
),
'Boost is a boost theme'
);
$this
->
assertTrue
(
upgrade_theme_is_from_family
(
'boo
t
st
rapbase
'
,
'cl
ean
'
),
'Cl
ean
is a boo
t
st
rap
base theme'
);
$this
->
assertFalse
(
upgrade_theme_is_from_family
(
'
boost'
,
'clean'
),
'Clean
is not a
boost
theme'
);
$this
->
assertTrue
(
upgrade_theme_is_from_family
(
'boost'
,
'cl
assic
'
),
'Cl
assic
is a boost base 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
->
assertFalse
(
upgrade_theme_is_from_family
(
'testtheme'
,
'orphantheme'
),
'ofphantheme is not a testtheme'
);
...
...
lib/tests/user_menu_test.php
View file @
e00f1c66
...
...
@@ -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.
$this
->
setAdminUser
();
$PAGE
->
set_url
(
'/'
);
$CFG
->
theme
=
'cl
ean
'
;
$CFG
->
theme
=
'cl
assic
'
;
$PAGE
->
reset_theme_and_output
();
$PAGE
->
initialise_theme_and_output
();
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment