mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 00:16:46 +02:00
Merge branch 'MDL-82717' of https://github.com/liamgm/moodle
This commit is contained in:
commit
2de9d83d7d
2 changed files with 18 additions and 1 deletions
|
@ -108,7 +108,7 @@ class nrps_info {
|
||||||
* @return \moodle_url the service URL.
|
* @return \moodle_url the service URL.
|
||||||
*/
|
*/
|
||||||
public function get_context_memberships_url(): \moodle_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…
Add table
Add a link
Reference in a new issue