| Línea 23... |
Línea 23... |
| 23 |
* @copyright 2016 Frédéric Massart - FMCorz.net
|
23 |
* @copyright 2016 Frédéric Massart - FMCorz.net
|
| 24 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
24 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
| 25 |
*/
|
25 |
*/
|
| 26 |
class hooks_test extends \advanced_testcase {
|
26 |
class hooks_test extends \advanced_testcase {
|
| Línea 27... |
Línea 27... |
| 27 |
|
27 |
|
| 28 |
public function test_hook_course_deleted() {
|
28 |
public function test_hook_course_deleted(): void {
|
| 29 |
$this->resetAfterTest();
|
29 |
$this->resetAfterTest();
|
| 30 |
$dg = $this->getDataGenerator();
|
30 |
$dg = $this->getDataGenerator();
|
| Línea 31... |
Línea 31... |
| 31 |
$ccg = $dg->get_plugin_generator('core_competency');
|
31 |
$ccg = $dg->get_plugin_generator('core_competency');
|
| Línea 70... |
Línea 70... |
| 70 |
$this->assertEquals(1, course_module_competency::count_records(['cmid' => $assign2b->cmid]));
|
70 |
$this->assertEquals(1, course_module_competency::count_records(['cmid' => $assign2b->cmid]));
|
| 71 |
$this->assertEquals(0, user_competency_course::count_records(['courseid' => $c1->id, 'userid' => $u1->id]));
|
71 |
$this->assertEquals(0, user_competency_course::count_records(['courseid' => $c1->id, 'userid' => $u1->id]));
|
| 72 |
$this->assertEquals(2, user_competency_course::count_records(['courseid' => $c2->id, 'userid' => $u1->id]));
|
72 |
$this->assertEquals(2, user_competency_course::count_records(['courseid' => $c2->id, 'userid' => $u1->id]));
|
| 73 |
}
|
73 |
}
|
| Línea 74... |
Línea 74... |
| 74 |
|
74 |
|
| 75 |
public function test_hook_course_module_deleted() {
|
75 |
public function test_hook_course_module_deleted(): void {
|
| 76 |
$this->resetAfterTest();
|
76 |
$this->resetAfterTest();
|
| 77 |
$dg = $this->getDataGenerator();
|
77 |
$dg = $this->getDataGenerator();
|
| Línea 78... |
Línea 78... |
| 78 |
$ccg = $dg->get_plugin_generator('core_competency');
|
78 |
$ccg = $dg->get_plugin_generator('core_competency');
|
| Línea 118... |
Línea 118... |
| 118 |
$this->assertEquals(1, course_module_competency::count_records(['cmid' => $assign2a->cmid]));
|
118 |
$this->assertEquals(1, course_module_competency::count_records(['cmid' => $assign2a->cmid]));
|
| 119 |
$this->assertEquals(1, course_module_competency::count_records(['cmid' => $assign2b->cmid]));
|
119 |
$this->assertEquals(1, course_module_competency::count_records(['cmid' => $assign2b->cmid]));
|
| 120 |
$this->assertEquals(2, user_competency_course::count_records(['courseid' => $c2->id, 'userid' => $u1->id]));
|
120 |
$this->assertEquals(2, user_competency_course::count_records(['courseid' => $c2->id, 'userid' => $u1->id]));
|
| 121 |
}
|
121 |
}
|
| Línea 122... |
Línea 122... |
| 122 |
|
122 |
|
| 123 |
public function test_hook_course_reset_competency_ratings() {
|
123 |
public function test_hook_course_reset_competency_ratings(): void {
|
| 124 |
$this->resetAfterTest();
|
124 |
$this->resetAfterTest();
|
| 125 |
$dg = $this->getDataGenerator();
|
125 |
$dg = $this->getDataGenerator();
|
| Línea 126... |
Línea 126... |
| 126 |
$ccg = $dg->get_plugin_generator('core_competency');
|
126 |
$ccg = $dg->get_plugin_generator('core_competency');
|
| Línea 165... |
Línea 165... |
| 165 |
$this->assertEquals(1, course_module_competency::count_records(['cmid' => $assign2b->cmid]));
|
165 |
$this->assertEquals(1, course_module_competency::count_records(['cmid' => $assign2b->cmid]));
|
| 166 |
$this->assertEquals(0, user_competency_course::count_records(['courseid' => $c1->id, 'userid' => $u1->id]));
|
166 |
$this->assertEquals(0, user_competency_course::count_records(['courseid' => $c1->id, 'userid' => $u1->id]));
|
| 167 |
$this->assertEquals(2, user_competency_course::count_records(['courseid' => $c2->id, 'userid' => $u1->id]));
|
167 |
$this->assertEquals(2, user_competency_course::count_records(['courseid' => $c2->id, 'userid' => $u1->id]));
|
| 168 |
}
|
168 |
}
|
| Línea 169... |
Línea 169... |
| 169 |
|
169 |
|
| 170 |
public function test_hook_cohort_deleted() {
|
170 |
public function test_hook_cohort_deleted(): void {
|
| 171 |
$this->resetAfterTest();
|
171 |
$this->resetAfterTest();
|
| Línea 172... |
Línea 172... |
| 172 |
$this->setAdminUser();
|
172 |
$this->setAdminUser();
|
| 173 |
|
173 |
|
| Línea 194... |
Línea 194... |
| 194 |
// Check that the association was removed.
|
194 |
// Check that the association was removed.
|
| 195 |
$this->assertEquals(1, \core_competency\template_cohort::count_records(array('templateid' => $t1->get('id'))));
|
195 |
$this->assertEquals(1, \core_competency\template_cohort::count_records(array('templateid' => $t1->get('id'))));
|
| 196 |
$this->assertEquals(0, \core_competency\template_cohort::count_records(array('templateid' => $t2->get('id'))));
|
196 |
$this->assertEquals(0, \core_competency\template_cohort::count_records(array('templateid' => $t2->get('id'))));
|
| 197 |
}
|
197 |
}
|
| Línea 198... |
Línea 198... |
| 198 |
|
198 |
|
| 199 |
public function test_hook_user_deleted() {
|
199 |
public function test_hook_user_deleted(): void {
|
| 200 |
$this->resetAfterTest();
|
200 |
$this->resetAfterTest();
|
| 201 |
$dg = $this->getDataGenerator();
|
201 |
$dg = $this->getDataGenerator();
|
| Línea 202... |
Línea 202... |
| 202 |
$ccg = $dg->get_plugin_generator('core_competency');
|
202 |
$ccg = $dg->get_plugin_generator('core_competency');
|