Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 36... Línea 36...
36
 * @category   test
36
 * @category   test
37
 * @copyright  2023 Safat Shahin <safat.shahin@moodle.com>
37
 * @copyright  2023 Safat Shahin <safat.shahin@moodle.com>
38
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
38
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
39
 * @covers \core_communication\api
39
 * @covers \core_communication\api
40
 */
40
 */
41
class api_test extends \advanced_testcase {
41
final class api_test extends \advanced_testcase {
42
    use matrix_test_helper_trait;
42
    use matrix_test_helper_trait;
43
    use communication_test_helper_trait;
43
    use communication_test_helper_trait;
Línea 44... Línea 44...
44
 
44
 
45
    public function setUp(): void {
45
    public function setUp(): void {
Línea 67... Línea 67...
67
        $provider = 'communication_matrix';
67
        $provider = 'communication_matrix';
Línea 68... Línea 68...
68
 
68
 
69
        // Set the data.
69
        // Set the data.
Línea 70... Línea 70...
70
        $communication->set_data($course);
70
        $communication->set_data($course);
Línea 71... Línea 71...
71
 
71
 
72
        $roomnameidenfier = $communication->get_provider() . 'roomname';
72
        $roomnameidentifier = $communication->get_provider() . 'roomname';
73
 
73
 
74
        // Test the set data.
74
        // Test the set data.
Línea 75... Línea 75...
75
        $this->assertEquals($roomname, $course->$roomnameidenfier);
75
        $this->assertEquals($roomname, $course->$roomnameidentifier);
76
        $this->assertEquals($provider, $course->selectedcommunication);
76
        $this->assertEquals($provider, $course->selectedcommunication);
Línea 280... Línea 280...
280
        $this->assertInstanceOf('\\core_communication\\task\\delete_room_task', $adhoctask);
280
        $this->assertInstanceOf('\\core_communication\\task\\delete_room_task', $adhoctask);
281
    }
281
    }
Línea 282... Línea 282...
282
 
282
 
283
    /**
283
    /**
284
     * Test the adding and removing of members from room.
-
 
285
     *
-
 
286
     * @covers ::add_members_to_room
-
 
287
     * @covers ::remove_members_from_room
284
     * Test the adding and removing of members from room.
288
     */
285
     */
289
    public function test_adding_and_removing_of_room_membership(): void {
286
    public function test_adding_and_removing_of_room_membership(): void {
290
        $course = $this->get_course();
287
        $course = $this->get_course();
Línea 311... Línea 308...
311
        $this->assertCount(1, $adhoctask);
308
        $this->assertCount(1, $adhoctask);
312
    }
309
    }
Línea 313... Línea 310...
313
 
310
 
314
    /**
311
    /**
315
     * Test the update of room membership with the change user role.
-
 
316
     *
-
 
317
     * @covers ::update_room_membership
312
     * Test the update of room membership with the change user role.
318
     */
313
     */
319
    public function test_update_room_membership_on_user_role_change(): void {
314
    public function test_update_room_membership_on_user_role_change(): void {
Línea 320... Línea 315...
320
        global $DB;
315
        global $DB;
Línea 340... Línea 335...
340
        $this->assertInstanceOf('\\core_communication\\task\\update_room_membership_task', $adhoctask);
335
        $this->assertInstanceOf('\\core_communication\\task\\update_room_membership_task', $adhoctask);
341
    }
336
    }
Línea 342... Línea 337...
342
 
337
 
343
    /**
338
    /**
344
     * Test sync_provider method for the sync of available provider.
-
 
345
     *
-
 
346
     * @covers ::sync_provider
339
     * Test sync_provider method for the sync of available provider.
347
     */
340
     */
348
    public function test_sync_provider(): void {
341
    public function test_sync_provider(): void {
349
        // Generate the data.
342
        // Generate the data.
350
        $user = $this->getDataGenerator()->create_user();
343
        $user = $this->getDataGenerator()->create_user();
Línea 358... Línea 351...
358
        $this->assertCount(2, $adhoctask);
351
        $this->assertCount(2, $adhoctask);
359
    }
352
    }
Línea 360... Línea 353...
360
 
353
 
361
    /**
354
    /**
362
     * Test the removal of all members from the room.
-
 
363
     *
-
 
364
     * @covers ::remove_all_members_from_room
355
     * Test the removal of all members from the room.
365
     */
356
     */
366
    public function test_remove_all_members_from_room(): void {
357
    public function test_remove_all_members_from_room(): void {
367
        $course = $this->get_course();
358
        $course = $this->get_course();
368
        $userid = $this->get_user()->id;
359
        $userid = $this->get_user()->id;
Línea 382... Línea 373...
382
        $this->assertCount(1, $adhoctask);
373
        $this->assertCount(1, $adhoctask);
383
    }
374
    }
Línea 384... Línea 375...
384
 
375
 
385
    /**
376
    /**
386
     * Test the configuration of room changes as well as the membership with the change of provider.
-
 
387
     *
-
 
388
     * @covers ::configure_room_and_membership_by_provider
377
     * Test the configuration of room changes as well as the membership with the change of provider.
389
     */
378
     */
390
    public function test_configure_room_and_membership_by_provider(): void {
379
    public function test_configure_room_and_membership_by_provider(): void {
Línea 391... Línea 380...
391
        global $DB;
380
        global $DB;