Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 109... Línea 109...
109
    }
109
    }
Línea 110... Línea 110...
110
 
110
 
111
    /**
111
    /**
112
     * Test for sync_members::do_context_membership_request().
112
     * Test for sync_members::do_context_membership_request().
113
     */
113
     */
114
    public function test_do_context_membership_request() {
114
    public function test_do_context_membership_request(): void {
115
        // Suppress output.
115
        // Suppress output.
116
        ob_start();
116
        ob_start();
117
        $members = $this->task->do_context_membership_request($this->context);
117
        $members = $this->task->do_context_membership_request($this->context);
118
        ob_end_clean();
118
        ob_end_clean();
119
        $this->assertFalse($members);
119
        $this->assertFalse($members);
Línea 120... Línea 120...
120
    }
120
    }
121
 
121
 
122
    /**
122
    /**
123
     * Test for sync_members::do_resourcelink_membership_request().
123
     * Test for sync_members::do_resourcelink_membership_request().
124
     */
124
     */
125
    public function test_do_resourcelink_membership_request() {
125
    public function test_do_resourcelink_membership_request(): void {
126
        $members = $this->task->do_resourcelink_membership_request($this->resourcelink);
126
        $members = $this->task->do_resourcelink_membership_request($this->resourcelink);
Línea 127... Línea 127...
127
        $this->assertFalse($members);
127
        $this->assertFalse($members);
128
    }
128
    }
129
 
129
 
130
    /**
130
    /**
131
     * Test for sync_members::execute() when auth_lti is disabled.
131
     * Test for sync_members::execute() when auth_lti is disabled.
132
     */
132
     */
133
    public function test_execute_authdisabled() {
133
    public function test_execute_authdisabled(): void {
134
        ob_start();
134
        ob_start();
135
        $this->task->execute();
135
        $this->task->execute();
136
        $output = ob_get_clean();
136
        $output = ob_get_clean();
Línea 137... Línea 137...
137
        $message = 'Skipping task - ' . get_string('pluginnotenabled', 'auth', get_string('pluginname', 'auth_lti'));
137
        $message = 'Skipping task - ' . get_string('pluginnotenabled', 'auth', get_string('pluginname', 'auth_lti'));
138
        $this->assertStringContainsString($message, $output);
138
        $this->assertStringContainsString($message, $output);
139
    }
139
    }
140
 
140
 
141
    /**
141
    /**
142
     * Test for sync_members::execute() when enrol_lti is disabled.
142
     * Test for sync_members::execute() when enrol_lti is disabled.
Línea 143... Línea 143...
143
     */
143
     */
144
    public function test_execute_enroldisabled() {
144
    public function test_execute_enroldisabled(): void {
Línea 153... Línea 153...
153
    }
153
    }
Línea 154... Línea 154...
154
 
154
 
155
    /**
155
    /**
156
     * Test for sync_members::execute().
156
     * Test for sync_members::execute().
157
     */
157
     */
158
    public function test_execute() {
158
    public function test_execute(): void {
159
        // Enable auth_lti.
159
        // Enable auth_lti.
Línea 160... Línea 160...
160
        $this->enable_auth();
160
        $this->enable_auth();
161
 
161
 
Línea 174... Línea 174...
174
    }
174
    }
Línea 175... Línea 175...
175
 
175
 
176
    /**
176
    /**
177
     * Test for sync_members::fetch_members_from_consumer() with no resource link nor context associated with the consumer.
177
     * Test for sync_members::fetch_members_from_consumer() with no resource link nor context associated with the consumer.
178
     */
178
     */
179
    public function test_fetch_members_from_consumer_noresourcelink_nocontext() {
179
    public function test_fetch_members_from_consumer_noresourcelink_nocontext(): void {
180
        // Suppress output.
180
        // Suppress output.
181
        ob_start();
181
        ob_start();
182
        $members = $this->task->fetch_members_from_consumer($this->consumer);
182
        $members = $this->task->fetch_members_from_consumer($this->consumer);
183
        ob_end_clean();
183
        ob_end_clean();
184
        $this->assertFalse($members);
184
        $this->assertFalse($members);
Línea 185... Línea 185...
185
    }
185
    }
186
 
186
 
187
    /**
187
    /**
188
     * Test for sync_members::get_name().
188
     * Test for sync_members::get_name().
189
     */
189
     */
190
    public function test_get_name() {
190
    public function test_get_name(): void {
Línea 191... Línea 191...
191
        $this->assertEquals(get_string('tasksyncmembers', 'enrol_lti'), $this->task->get_name());
191
        $this->assertEquals(get_string('tasksyncmembers', 'enrol_lti'), $this->task->get_name());
192
    }
192
    }
193
 
193
 
194
    /**
194
    /**
195
     * Test for sync_members::should_sync_enrol().
195
     * Test for sync_members::should_sync_enrol().
196
     */
196
     */
197
    public function test_should_sync_enrol() {
197
    public function test_should_sync_enrol(): void {
198
        $this->assertTrue($this->task->should_sync_enrol(helper::MEMBER_SYNC_ENROL_AND_UNENROL));
198
        $this->assertTrue($this->task->should_sync_enrol(helper::MEMBER_SYNC_ENROL_AND_UNENROL));
Línea 199... Línea 199...
199
        $this->assertTrue($this->task->should_sync_enrol(helper::MEMBER_SYNC_ENROL_NEW));
199
        $this->assertTrue($this->task->should_sync_enrol(helper::MEMBER_SYNC_ENROL_NEW));
200
        $this->assertFalse($this->task->should_sync_enrol(helper::MEMBER_SYNC_UNENROL_MISSING));
200
        $this->assertFalse($this->task->should_sync_enrol(helper::MEMBER_SYNC_UNENROL_MISSING));
201
    }
201
    }
202
 
202
 
203
    /**
203
    /**
204
     * Test for sync_members::should_sync_unenrol().
204
     * Test for sync_members::should_sync_unenrol().
205
     */
205
     */
206
    public function test_should_sync_unenrol() {
206
    public function test_should_sync_unenrol(): void {
Línea 207... Línea 207...
207
        $this->assertTrue($this->task->should_sync_unenrol(helper::MEMBER_SYNC_ENROL_AND_UNENROL));
207
        $this->assertTrue($this->task->should_sync_unenrol(helper::MEMBER_SYNC_ENROL_AND_UNENROL));
208
        $this->assertFalse($this->task->should_sync_unenrol(helper::MEMBER_SYNC_ENROL_NEW));
208
        $this->assertFalse($this->task->should_sync_unenrol(helper::MEMBER_SYNC_ENROL_NEW));
209
        $this->assertTrue($this->task->should_sync_unenrol(helper::MEMBER_SYNC_UNENROL_MISSING));
209
        $this->assertTrue($this->task->should_sync_unenrol(helper::MEMBER_SYNC_UNENROL_MISSING));
210
    }
210
    }
211
 
211
 
212
    /**
212
    /**
213
     * Test for sync_members::sync_member_information().
213
     * Test for sync_members::sync_member_information().
214
     */
214
     */
215
    public function test_sync_member_information() {
215
    public function test_sync_member_information(): void {
216
        list($users, $enrolledcount) = $this->task->sync_member_information($this->tool, $this->consumer, $this->members);
216
        list($users, $enrolledcount) = $this->task->sync_member_information($this->tool, $this->consumer, $this->members);
Línea 217... Línea 217...
217
        $membercount = count($this->members);
217
        $membercount = count($this->members);
218
        $this->assertCount(10, $this->members);
218
        $this->assertCount(10, $this->members);
219
        $this->assertCount($membercount, $users);
219
        $this->assertCount($membercount, $users);
220
        $this->assertEquals($membercount, $enrolledcount);
220
        $this->assertEquals($membercount, $enrolledcount);
221
    }
221
    }
222
 
222
 
223
    /**
223
    /**
224
     * Test for sync_members::sync_profile_images().
224
     * Test for sync_members::sync_profile_images().
225
     */
225
     */
Línea 238... Línea 238...
238
    }
238
    }
Línea 239... Línea 239...
239
 
239
 
240
    /**
240
    /**
241
     * Test for sync_members::sync_unenrol().
241
     * Test for sync_members::sync_unenrol().
242
     */
242
     */
243
    public function test_sync_unenrol() {
243
    public function test_sync_unenrol(): void {
244
        $tool = $this->tool;
244
        $tool = $this->tool;
Línea 245... Línea 245...
245
        $task = $this->task;
245
        $task = $this->task;