Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 55... Línea 55...
55
    /**
55
    /**
56
     * Test utility methods used in syn test, fail here means something
56
     * Test utility methods used in syn test, fail here means something
57
     * in core accesslib was changed, but it is possible that only this test
57
     * in core accesslib was changed, but it is possible that only this test
58
     * is affected, nto the plugin itself...
58
     * is affected, nto the plugin itself...
59
     */
59
     */
60
    public function test_utils() {
60
    public function test_utils(): void {
61
        global $DB;
61
        global $DB;
Línea 62... Línea 62...
62
 
62
 
Línea 63... Línea 63...
63
        $this->resetAfterTest();
63
        $this->resetAfterTest();
Línea 82... Línea 82...
82
        $this->disable_role_sync($studentrole->id);
82
        $this->disable_role_sync($studentrole->id);
83
        $roles = get_roles_with_capability('enrol/category:synchronised', CAP_ALLOW, $syscontext);
83
        $roles = get_roles_with_capability('enrol/category:synchronised', CAP_ALLOW, $syscontext);
84
        $this->assertEmpty($roles);
84
        $this->assertEmpty($roles);
85
    }
85
    }
Línea 86... Línea 86...
86
 
86
 
87
    public function test_handler_sync() {
87
    public function test_handler_sync(): void {
88
        global $DB, $CFG;
88
        global $DB, $CFG;
Línea 89... Línea 89...
89
        require_once($CFG->dirroot.'/enrol/category/locallib.php');
89
        require_once($CFG->dirroot.'/enrol/category/locallib.php');
Línea 155... Línea 155...
155
        role_assign($studentrole->id, $user3->id, \context_coursecat::instance($cat1->id));
155
        role_assign($studentrole->id, $user3->id, \context_coursecat::instance($cat1->id));
156
        $this->assertEquals(3, $DB->count_records('user_enrolments', array()));
156
        $this->assertEquals(3, $DB->count_records('user_enrolments', array()));
Línea 157... Línea 157...
157
 
157
 
Línea 158... Línea 158...
158
    }
158
    }
159
 
159
 
160
    public function test_sync_course() {
160
    public function test_sync_course(): void {
Línea 161... Línea 161...
161
        global $DB, $CFG;
161
        global $DB, $CFG;
Línea 249... Línea 249...
249
        enrol_category_sync_course($course4);
249
        enrol_category_sync_course($course4);
250
        $this->assertEquals(0, $DB->count_records('user_enrolments', array()));
250
        $this->assertEquals(0, $DB->count_records('user_enrolments', array()));
251
        $this->assertEquals(0, $DB->count_records('enrol', array('enrol'=>'category')));
251
        $this->assertEquals(0, $DB->count_records('enrol', array('enrol'=>'category')));
252
    }
252
    }
Línea 253... Línea 253...
253
 
253
 
254
    public function test_sync_full() {
254
    public function test_sync_full(): void {
255
        global $DB, $CFG;
255
        global $DB, $CFG;
Línea 256... Línea 256...
256
        require_once($CFG->dirroot.'/enrol/category/locallib.php');
256
        require_once($CFG->dirroot.'/enrol/category/locallib.php');