Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 22... Línea 22...
22
 * @package enrol_lti
22
 * @package enrol_lti
23
 * @copyright 2021 Jake Dallimore <jrhdallimore@gmail.com>
23
 * @copyright 2021 Jake Dallimore <jrhdallimore@gmail.com>
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
 * @coversDefaultClass \enrol_lti\local\ltiadvantage\entity\nrps_info
25
 * @coversDefaultClass \enrol_lti\local\ltiadvantage\entity\nrps_info
26
 */
26
 */
27
class nrps_info_test extends \advanced_testcase {
27
final class nrps_info_test extends \advanced_testcase {
Línea 28... Línea 28...
28
 
28
 
29
    /**
29
    /**
30
     * Test creation of the object instances.
30
     * Test creation of the object instances.
31
     *
31
     *
Línea 50... Línea 50...
50
 
50
 
51
    /**
51
    /**
52
     * Data provider for testing object instantiation.
52
     * Data provider for testing object instantiation.
53
     * @return array the data for testing.
53
     * @return array the data for testing.
54
     */
54
     */
55
    public function instantiation_data_provider(): array {
55
    public static function instantiation_data_provider(): array {
56
        return [
56
        return [
57
            'Valid creation' => [
57
            'Valid creation' => [
58
                'args' => [
58
                'args' => [
59
                    'contextmembershipsurl' => new \moodle_url('https://lms.example.com/45/memberships'),
59
                    'contextmembershipsurl' => new \moodle_url('https://lms.example.com/45/memberships'),
Línea 96... Línea 96...
96
                    'serviceversions' => ['1.0']
96
                    'serviceversions' => ['1.0']
97
                ]
97
                ]
98
            ]
98
            ]
99
        ];
99
        ];
100
    }
100
    }
-
 
101
 
-
 
102
    /**
-
 
103
     * Verify that the contextmembershipurl property can be gotten and is immutable.
-
 
104
     *
-
 
105
     * @covers ::get_context_memberships_url
-
 
106
     */
-
 
107
    public function test_get_context_memberships_url(): void {
-
 
108
        $nrpsendpoint = 'https://lms.example.com/45/memberships';
-
 
109
        $nrpsinfo = nrps_info::create(new \moodle_url($nrpsendpoint));
-
 
110
        $membershipsurlcopy = $nrpsinfo->get_context_memberships_url();
-
 
111
        $this->assertEquals($nrpsendpoint, $membershipsurlcopy->out(false));
-
 
112
        $rlid = '01234567-1234-5678-90ab-123456789abc';
-
 
113
        $membershipsurlcopy->param('rlid', $rlid);
-
 
114
        $this->assertEquals($nrpsendpoint . '?rlid=' . $rlid, $membershipsurlcopy->out(false));
-
 
115
        $this->assertEquals($nrpsendpoint, $nrpsinfo->get_context_memberships_url()->out(false));
-
 
116
    }
-
 
117
 
101
}
118
}