mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 13:38:32 +01:00
Merge branch 'MDL-82717-404' of https://github.com/liamgm/moodle into MOODLE_404_STABLE
This commit is contained in:
commit
2558c6a9b9
@ -108,7 +108,7 @@ class nrps_info {
|
||||
* @return \moodle_url the service URL.
|
||||
*/
|
||||
public function get_context_memberships_url(): \moodle_url {
|
||||
return $this->contextmembershipsurl;
|
||||
return clone $this->contextmembershipsurl;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -98,4 +98,21 @@ class nrps_info_test extends \advanced_testcase {
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the contextmembershipurl property can be gotten and is immutable.
|
||||
*
|
||||
* @covers ::get_context_memberships_url
|
||||
*/
|
||||
public function test_get_context_memberships_url(): void {
|
||||
$nrpsendpoint = 'https://lms.example.com/45/memberships';
|
||||
$nrpsinfo = nrps_info::create(new \moodle_url($nrpsendpoint));
|
||||
$membershipsurlcopy = $nrpsinfo->get_context_memberships_url();
|
||||
$this->assertEquals($nrpsendpoint, $membershipsurlcopy->out(false));
|
||||
$rlid = '01234567-1234-5678-90ab-123456789abc';
|
||||
$membershipsurlcopy->param('rlid', $rlid);
|
||||
$this->assertEquals($nrpsendpoint . '?rlid=' . $rlid, $membershipsurlcopy->out(false));
|
||||
$this->assertEquals($nrpsendpoint, $nrpsinfo->get_context_memberships_url()->out(false));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user