MDL-83468 phpunit: Replace uses of setMethods with onlyMethods
The PHPUnit MockBuilder `setMethods()` method has been deprecated in favour of the more accurately defined `onlyMethods()` method. This was previously addressed in MDL-71036 for Moodle 3.11, but these cases have crept back in.
This commit is contained in:
@@ -373,7 +373,7 @@ final class instance_test extends advanced_testcase {
|
||||
*/
|
||||
public function test_user_must_wait_to_join(bool $isadmin, bool $ismoderator, bool $haswaitingroom, bool $expected): void {
|
||||
$stub = $this->getMockBuilder(instance::class)
|
||||
->setMethods([
|
||||
->onlyMethods([
|
||||
'get_instance_var',
|
||||
'is_admin',
|
||||
'is_moderator',
|
||||
@@ -419,7 +419,7 @@ final class instance_test extends advanced_testcase {
|
||||
bool $expected
|
||||
): void {
|
||||
$stub = $this->getMockBuilder(instance::class)
|
||||
->setMethods([
|
||||
->onlyMethods([
|
||||
'is_admin',
|
||||
'is_moderator',
|
||||
])
|
||||
@@ -456,7 +456,7 @@ final class instance_test extends advanced_testcase {
|
||||
*/
|
||||
public function test_get_current_user_password(bool $isadmin, bool $ismoderator, bool $expectedmodpassword): void {
|
||||
$stub = $this->getMockBuilder(instance::class)
|
||||
->setMethods([
|
||||
->onlyMethods([
|
||||
'is_admin',
|
||||
'is_moderator',
|
||||
'get_moderator_password',
|
||||
@@ -501,7 +501,7 @@ final class instance_test extends advanced_testcase {
|
||||
*/
|
||||
public function test_get_current_user_role(bool $isadmin, bool $ismoderator, bool $expectedmodrole): void {
|
||||
$stub = $this->getMockBuilder(instance::class)
|
||||
->setMethods([
|
||||
->onlyMethods([
|
||||
'is_admin',
|
||||
'is_moderator',
|
||||
])
|
||||
@@ -546,7 +546,7 @@ final class instance_test extends advanced_testcase {
|
||||
bool $expected
|
||||
): void {
|
||||
$stub = $this->getMockBuilder(instance::class)
|
||||
->setMethods([
|
||||
->onlyMethods([
|
||||
'is_recorded',
|
||||
'should_show_recording_button',
|
||||
])
|
||||
|
||||
@@ -407,7 +407,7 @@ EOD;
|
||||
$toolproxy['secret'] = 'peM7YDx420bo';
|
||||
|
||||
$reghelper = $this->getMockBuilder(registration_helper::class)
|
||||
->setMethods(['get_tool_proxy'])
|
||||
->onlyMethods(['get_tool_proxy'])
|
||||
->getMock();
|
||||
$map = [[$toolproxy['id'], $toolproxy]];
|
||||
$reghelper->method('get_tool_proxy')
|
||||
|
||||
Reference in New Issue
Block a user