Skip to content

Commit

Permalink
checkout v4
Browse files Browse the repository at this point in the history
  • Loading branch information
rdebleu committed Mar 8, 2024
1 parent 4ac3656 commit 55b55d5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

steps:
- name: checkout plugin
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: this-plugin

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

steps:
- name: checkout plugin
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: this-plugin

Expand Down
14 changes: 5 additions & 9 deletions tests/condition_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,10 @@ public function test_sections(): void {
// Create course with language turned on and a Page.
$generator = $this->getDataGenerator();
$course = $generator->create_course();
$user1 = $generator->create_user()->id;
$user1 = $generator->create_and_enrol($course)->id;
// MDL-68333 hack when nl language is not installed.
$DB->set_field('user', 'lang', 'nl', ['id' => $user1]);
$user2 = $generator->create_user()->id;
$generator->enrol_user($user1, $course->id);
$generator->enrol_user($user2, $course->id);
$user2 = $generator->create_and_enrol($course)->id;
$cond = '{"op":"|","show":false,"c":[{"type":"language","id":"nl"}]}';
$DB->set_field('course_sections', 'availability', $cond, ['course' => $course->id, 'section' => 0]);
$cond = '{"op":"|","show":true,"c":[{"type":"language","id":""}]}';
Expand Down Expand Up @@ -217,13 +215,12 @@ public function test_frontend(): void {
$les = new \lesson($generator->get_plugin_generator('mod_lesson')->create_instance($params));
$params['lang'] = 'nl';
$page = $generator->get_plugin_generator('mod_page')->create_instance($params);
$user = $generator->create_user();
$user = $generator->create_and_enrol($course);
$modinfo = get_fast_modinfo($course);
$cm1 = $modinfo->get_cm($les->cmid);
$cm2 = $modinfo->get_cm($page->cmid);
$sections = $modinfo->get_section_info_all();
$generator->enrol_user($user->id, $course->id);


$name = 'availability_language\frontend';
$frontend = new \availability_language\frontend();
// There is only 1 language installed, so we cannot assert allow add will return true.
Expand Down Expand Up @@ -264,8 +261,7 @@ public function test_backend(): void {
$generator = $this->getDataGenerator();
$course = $generator->create_course();
$context = \context_course::instance($course->id);
$user = $generator->create_user();
$generator->enrol_user($user->id, $course->id);
$user = $generator->create_and_enrol($course);
$pagegen = $generator->get_plugin_generator('mod_page');
$restriction = \core_availability\tree::get_root_json([condition::get_json('fr')]);
$pagegen->create_instance(['course' => $course, 'availability' => json_encode($restriction)]);
Expand Down

0 comments on commit 55b55d5

Please sign in to comment.