Commit 81407f18 authored by Eloy Lafuente's avatar Eloy Lafuente
Browse files

MDL-71036 phpunit: Mock->setMethods() silently deprecated

The current ->setMethods() has been silently (won't emit any
warning) in PHPUnit 9. And will stop working (current plans)
in PHPUnit 10.

Basically the now deprecated method has been split into:

- onlyMethods(): To point to existing methods in the mocked artifact.
- addMethods(): To point to non existing (yet) methods in the mocked
  artifact.

In practice that means that all our current setMethods() calls can be
converted to onlyMethods() (existing) and done. The addMethods() is
mostly useful on development phases, not final testing.

Finally note that <null> isn't accepted anymore as parameter to
double all the methods. Instead empty array [] must be used.

Link: https://github.com/sebastianbergmann/phpunit/issues/3770
parent 8a14a7bd
......@@ -149,7 +149,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
public function test_get_config_file_contents_with_single_run() {
$mockbuilder = $this->getMockBuilder('behat_config_util');
$mockbuilder->setMethods(array('get_theme_test_directory', 'get_list_of_themes', 'get_default_theme', 'get_theme_config'));
$mockbuilder->onlyMethods(array('get_theme_test_directory', 'get_list_of_themes', 'get_default_theme', 'get_theme_config'));
$behatconfigutil = $mockbuilder->getMock();
......@@ -188,7 +188,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
public function test_get_config_file_contents_with_single_run_no_theme() {
$mockbuilder = $this->getMockBuilder('behat_config_util');
$mockbuilder->setMethods(array('get_theme_test_directory', 'get_list_of_themes', 'get_default_theme', 'get_theme_config'));
$mockbuilder->onlyMethods(array('get_theme_test_directory', 'get_list_of_themes', 'get_default_theme', 'get_theme_config'));
$behatconfigutil = $mockbuilder->getMock();
......@@ -242,7 +242,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
public function test_get_config_file_contents_with_parallel_run() {
$mockbuilder = $this->getMockBuilder('behat_config_util');
$mockbuilder->setMethods(array('get_theme_test_directory', 'get_list_of_themes', 'get_default_theme', 'get_theme_config'));
$mockbuilder->onlyMethods(array('get_theme_test_directory', 'get_list_of_themes', 'get_default_theme', 'get_theme_config'));
$behatconfigutil = $mockbuilder->getMock();
......@@ -345,7 +345,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
public function test_get_config_file_contents_with_parallel_run_optimize_tags() {
$mockbuilder = $this->getMockBuilder('behat_config_util');
$mockbuilder->setMethods(array('get_theme_test_directory', 'get_list_of_themes', 'get_default_theme', 'get_theme_config'));
$mockbuilder->onlyMethods(array('get_theme_test_directory', 'get_list_of_themes', 'get_default_theme', 'get_theme_config'));
$behatconfigutil = $mockbuilder->getMock();
......@@ -489,7 +489,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
public function test_get_config_file_contents_with_blacklisted_tags() {
$mockbuilder = $this->getMockBuilder('behat_config_util');
$mockbuilder->setMethods(array('get_theme_test_directory', 'get_list_of_themes', 'get_blacklisted_tests_for_theme',
$mockbuilder->onlyMethods(array('get_theme_test_directory', 'get_list_of_themes', 'get_blacklisted_tests_for_theme',
'get_default_theme', 'get_theme_config'));
$behatconfigutil = $mockbuilder->getMock();
......@@ -553,7 +553,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
public function test_get_config_file_contents_with_blacklisted_features_contexts() {
$mockbuilder = $this->getMockBuilder('behat_config_util');
$mockbuilder->setMethods(array('get_theme_test_directory', 'get_list_of_themes', 'get_blacklisted_tests_for_theme',
$mockbuilder->onlyMethods(array('get_theme_test_directory', 'get_list_of_themes', 'get_blacklisted_tests_for_theme',
'get_default_theme', 'get_theme_config'));
$behatconfigutil = $mockbuilder->getMock();
......@@ -632,7 +632,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
public function test_core_features_to_include_in_specified_theme() {
$mockbuilder = $this->getMockBuilder('behat_config_util');
$mockbuilder->setMethods(array('get_theme_test_directory', 'get_list_of_themes', 'get_default_theme', 'get_theme_config'));
$mockbuilder->onlyMethods(array('get_theme_test_directory', 'get_list_of_themes', 'get_default_theme', 'get_theme_config'));
$behatconfigutil = $mockbuilder->getMock();
......
......@@ -857,7 +857,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$expiredcontext->save();
$mockprivacymanager = $this->getMockBuilder(\core_privacy\manager::class)
->setMethods([
->onlyMethods([
'delete_data_for_user',
'delete_data_for_users_in_context',
'delete_data_for_all_users_in_context',
......@@ -868,7 +868,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$mockprivacymanager->expects($this->never())->method('delete_data_for_users_in_context');
$manager = $this->getMockBuilder(\tool_dataprivacy\expired_contexts_manager::class)
->setMethods(['get_privacy_manager'])
->onlyMethods(['get_privacy_manager'])
->getMock();
$manager->method('get_privacy_manager')->willReturn($mockprivacymanager);
......@@ -935,7 +935,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$expiredcontext->save();
$mockprivacymanager = $this->getMockBuilder(\core_privacy\manager::class)
->setMethods([
->onlyMethods([
'delete_data_for_user',
'delete_data_for_users_in_context',
'delete_data_for_all_users_in_context',
......@@ -956,7 +956,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
}));
$manager = $this->getMockBuilder(\tool_dataprivacy\expired_contexts_manager::class)
->setMethods(['get_privacy_manager'])
->onlyMethods(['get_privacy_manager'])
->getMock();
$manager->method('get_privacy_manager')->willReturn($mockprivacymanager);
......@@ -1023,7 +1023,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$expiredcontext->save();
$mockprivacymanager = $this->getMockBuilder(\core_privacy\manager::class)
->setMethods([
->onlyMethods([
'delete_data_for_user',
'delete_data_for_users_in_context',
'delete_data_for_all_users_in_context',
......@@ -1044,7 +1044,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
}));
$manager = $this->getMockBuilder(\tool_dataprivacy\expired_contexts_manager::class)
->setMethods(['get_privacy_manager'])
->onlyMethods(['get_privacy_manager'])
->getMock();
$manager->method('get_privacy_manager')->willReturn($mockprivacymanager);
......@@ -1112,7 +1112,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$expiredcontext->save();
$mockprivacymanager = $this->getMockBuilder(\core_privacy\manager::class)
->setMethods([
->onlyMethods([
'delete_data_for_user',
'delete_data_for_users_in_context',
'delete_data_for_all_users_in_context',
......@@ -1133,7 +1133,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
}));
$manager = $this->getMockBuilder(\tool_dataprivacy\expired_contexts_manager::class)
->setMethods(['get_privacy_manager'])
->onlyMethods(['get_privacy_manager'])
->getMock();
$manager->method('get_privacy_manager')->willReturn($mockprivacymanager);
......@@ -1208,7 +1208,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$expiredcontext->save();
$mockprivacymanager = $this->getMockBuilder(\core_privacy\manager::class)
->setMethods([
->onlyMethods([
'delete_data_for_user',
'delete_data_for_users_in_context',
'delete_data_for_all_users_in_context',
......@@ -1229,7 +1229,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
}));
$manager = $this->getMockBuilder(\tool_dataprivacy\expired_contexts_manager::class)
->setMethods(['get_privacy_manager'])
->onlyMethods(['get_privacy_manager'])
->getMock();
$manager->method('get_privacy_manager')->willReturn($mockprivacymanager);
......@@ -1260,7 +1260,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$expiredcontext->save();
$mockprivacymanager = $this->getMockBuilder(\core_privacy\manager::class)
->setMethods([
->onlyMethods([
'delete_data_for_user',
'delete_data_for_all_users_in_context',
])
......@@ -1269,7 +1269,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$mockprivacymanager->expects($this->never())->method('delete_data_for_all_users_in_context');
$manager = $this->getMockBuilder(\tool_dataprivacy\expired_contexts_manager::class)
->setMethods(['get_privacy_manager'])
->onlyMethods(['get_privacy_manager'])
->getMock();
$manager->set_progress(new \null_progress_trace());
......@@ -1299,7 +1299,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$expiredcontext->save();
$mockprivacymanager = $this->getMockBuilder(\core_privacy\manager::class)
->setMethods([
->onlyMethods([
'delete_data_for_user',
'delete_data_for_all_users_in_context',
])
......@@ -1308,7 +1308,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$mockprivacymanager->expects($this->never())->method('delete_data_for_all_users_in_context');
$manager = $this->getMockBuilder(\tool_dataprivacy\expired_contexts_manager::class)
->setMethods(['get_privacy_manager'])
->onlyMethods(['get_privacy_manager'])
->getMock();
$manager->set_progress(new \null_progress_trace());
......@@ -1335,7 +1335,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$expiredcontext->save();
$mockprivacymanager = $this->getMockBuilder(\core_privacy\manager::class)
->setMethods([
->onlyMethods([
'delete_data_for_user',
'delete_data_for_all_users_in_context',
])
......@@ -1344,7 +1344,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$mockprivacymanager->expects($this->never())->method('delete_data_for_all_users_in_context');
$manager = $this->getMockBuilder(\tool_dataprivacy\expired_contexts_manager::class)
->setMethods(['get_privacy_manager'])
->onlyMethods(['get_privacy_manager'])
->getMock();
$manager->set_progress(new \null_progress_trace());
......@@ -1382,7 +1382,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$expiredcontext->save();
$mockprivacymanager = $this->getMockBuilder(\core_privacy\manager::class)
->setMethods([
->onlyMethods([
'delete_data_for_user',
'delete_data_for_all_users_in_context',
])
......@@ -1396,7 +1396,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
);
$manager = $this->getMockBuilder(\tool_dataprivacy\expired_contexts_manager::class)
->setMethods(['get_privacy_manager'])
->onlyMethods(['get_privacy_manager'])
->getMock();
$manager->set_progress(new \null_progress_trace());
......@@ -1442,7 +1442,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$expiredcontext->save();
$mockprivacymanager = $this->getMockBuilder(\core_privacy\manager::class)
->setMethods([
->onlyMethods([
'delete_data_for_user',
'delete_data_for_all_users_in_context',
])
......@@ -1451,7 +1451,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$mockprivacymanager->expects($this->once())->method('delete_data_for_all_users_in_context');
$manager = $this->getMockBuilder(\tool_dataprivacy\expired_contexts_manager::class)
->setMethods(['get_privacy_manager'])
->onlyMethods(['get_privacy_manager'])
->getMock();
$manager->set_progress(new \null_progress_trace());
......@@ -1494,7 +1494,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$this->setUser();
$mockprivacymanager = $this->getMockBuilder(\core_privacy\manager::class)
->setMethods([
->onlyMethods([
'delete_data_for_user',
'delete_data_for_all_users_in_context',
])
......@@ -1503,7 +1503,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$mockprivacymanager->expects($this->never())->method('delete_data_for_all_users_in_context');
$manager = $this->getMockBuilder(\tool_dataprivacy\expired_contexts_manager::class)
->setMethods(['get_privacy_manager'])
->onlyMethods(['get_privacy_manager'])
->getMock();
$manager->set_progress(new \null_progress_trace());
......@@ -1546,7 +1546,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
set_config('siteadmins', implode(',', $admins));
$mockprivacymanager = $this->getMockBuilder(\core_privacy\manager::class)
->setMethods([
->onlyMethods([
'delete_data_for_user',
'delete_data_for_all_users_in_context',
])
......@@ -1555,7 +1555,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$mockprivacymanager->expects($this->never())->method('delete_data_for_all_users_in_context');
$manager = $this->getMockBuilder(\tool_dataprivacy\expired_contexts_manager::class)
->setMethods(['get_privacy_manager'])
->onlyMethods(['get_privacy_manager'])
->getMock();
$manager->set_progress(new \null_progress_trace());
......@@ -1600,7 +1600,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$expiredblockcontext->save();
$mockprivacymanager = $this->getMockBuilder(\core_privacy\manager::class)
->setMethods([
->onlyMethods([
'delete_data_for_user',
'delete_data_for_all_users_in_context',
])
......@@ -1614,7 +1614,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
);
$manager = $this->getMockBuilder(\tool_dataprivacy\expired_contexts_manager::class)
->setMethods(['get_privacy_manager'])
->onlyMethods(['get_privacy_manager'])
->getMock();
$manager->set_progress(new \null_progress_trace());
......@@ -1653,7 +1653,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$expiredusercontext->save();
$mockprivacymanager = $this->getMockBuilder(\core_privacy\manager::class)
->setMethods([
->onlyMethods([
'delete_data_for_user',
'delete_data_for_all_users_in_context',
])
......@@ -1667,7 +1667,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
);
$manager = $this->getMockBuilder(\tool_dataprivacy\expired_contexts_manager::class)
->setMethods(['get_privacy_manager'])
->onlyMethods(['get_privacy_manager'])
->getMock();
$manager->set_progress(new \null_progress_trace());
......@@ -1705,7 +1705,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$expiredcontext->save();
$mockprivacymanager = $this->getMockBuilder(\core_privacy\manager::class)
->setMethods([
->onlyMethods([
'delete_data_for_user',
'delete_data_for_all_users_in_context',
])
......@@ -1714,7 +1714,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$mockprivacymanager->expects($this->never())->method('delete_data_for_all_users_in_context');
$manager = $this->getMockBuilder(\tool_dataprivacy\expired_contexts_manager::class)
->setMethods(['get_privacy_manager'])
->onlyMethods(['get_privacy_manager'])
->getMock();
$manager->set_progress(new \null_progress_trace());
$manager->method('get_privacy_manager')->willReturn($mockprivacymanager);
......@@ -1756,7 +1756,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$expiredcontext->save();
$mockprivacymanager = $this->getMockBuilder(\core_privacy\manager::class)
->setMethods([
->onlyMethods([
'delete_data_for_user',
'delete_data_for_all_users_in_context',
])
......@@ -1765,7 +1765,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$mockprivacymanager->expects($this->never())->method('delete_data_for_all_users_in_context');
$manager = $this->getMockBuilder(\tool_dataprivacy\expired_contexts_manager::class)
->setMethods(['get_privacy_manager'])
->onlyMethods(['get_privacy_manager'])
->getMock();
$manager->set_progress(new \null_progress_trace());
......@@ -1814,7 +1814,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$expiredforumcontext->save();
$mockprivacymanager = $this->getMockBuilder(\core_privacy\manager::class)
->setMethods([
->onlyMethods([
'delete_data_for_user',
'delete_data_for_all_users_in_context',
])
......@@ -1823,7 +1823,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$mockprivacymanager->expects($this->never())->method('delete_data_for_all_users_in_context');
$manager = $this->getMockBuilder(\tool_dataprivacy\expired_contexts_manager::class)
->setMethods(['get_privacy_manager'])
->onlyMethods(['get_privacy_manager'])
->getMock();
$manager->set_progress(new \null_progress_trace());
......@@ -1872,7 +1872,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
$expiredforumcontext->save();
$mockprivacymanager = $this->getMockBuilder(\core_privacy\manager::class)
->setMethods([
->onlyMethods([
'delete_data_for_user',
'delete_data_for_all_users_in_context',
])
......@@ -1886,7 +1886,7 @@ class tool_dataprivacy_expired_contexts_testcase extends advanced_testcase {
);
$manager = $this->getMockBuilder(\tool_dataprivacy\expired_contexts_manager::class)
->setMethods(['get_privacy_manager'])
->onlyMethods(['get_privacy_manager'])
->getMock();
$manager->set_progress(new \null_progress_trace());
......
......@@ -42,7 +42,7 @@ class tool_dataprivacy_filtered_userlist_testcase extends advanced_testcase {
public function test_apply_expired_contexts_filters(array $initial, array $expired, array $unexpired, array $expected) {
$userlist = $this->getMockBuilder(\tool_dataprivacy\filtered_userlist::class)
->disableOriginalConstructor()
->setMethods(null)
->onlyMethods([])
->getMock();
$rc = new \ReflectionClass(\tool_dataprivacy\filtered_userlist::class);
......
......@@ -42,7 +42,7 @@ class locale_testcase extends \advanced_testcase {
// - second setlocale() call which try to set new 'es' locale
// - third setlocale() call which restore locale.
$mock = $this->getMockBuilder(\tool_langimport\locale::class)
->setMethods(['set_locale'])
->onlyMethods(['set_locale'])
->getMock();
$mock->method('set_locale')->will($this->onConsecutiveCalls('en', 'es', 'en'));
......@@ -55,7 +55,7 @@ class locale_testcase extends \advanced_testcase {
// - second setlocale() call which fail to set new locale
// - third setlocale() call which restore locale.
$mock = $this->getMockBuilder(\tool_langimport\locale::class)
->setMethods(['set_locale'])
->onlyMethods(['set_locale'])
->getMock();
$mock->method('set_locale')->will($this->onConsecutiveCalls('en', false, 'en'));
......
......@@ -43,7 +43,7 @@ class tool_monitor_subscription_testcase extends advanced_testcase {
$sub->name = 'My test rule';
$sub->courseid = 20;
$mockbuilder = $this->getMockBuilder('\tool_monitor\subscription');
$mockbuilder->setMethods(null);
$mockbuilder->onlyMethods([]);
$mockbuilder->setConstructorArgs(array($sub));
$this->subscription = $mockbuilder->getMock();
}
......
......@@ -117,7 +117,7 @@ class step_testcase extends advanced_testcase {
*/
public function test_fetch() {
$step = $this->getMockBuilder(\tool_usertours\step::class)
->setMethods(['reload_from_record'])
->onlyMethods(['reload_from_record'])
->getMock()
;
......@@ -185,7 +185,7 @@ class step_testcase extends advanced_testcase {
*/
public function test_is_first_step($sortorder, $count, $isfirst, $islast) {
$step = $this->getMockBuilder(\tool_usertours\step::class)
->setMethods(['get_sortorder'])
->onlyMethods(['get_sortorder'])
->getMock();
$step->expects($this->once())
......@@ -207,11 +207,11 @@ class step_testcase extends advanced_testcase {
*/
public function test_is_last_step($sortorder, $count, $isfirst, $islast) {
$step = $this->getMockBuilder(\tool_usertours\step::class)
->setMethods(['get_sortorder', 'get_tour'])
->onlyMethods(['get_sortorder', 'get_tour'])
->getMock();
$tour = $this->getMockBuilder(\tool_usertours\tour::class)
->setMethods(['count_steps'])
->onlyMethods(['count_steps'])
->getMock();
$step->expects($this->once())
......@@ -362,7 +362,7 @@ class step_testcase extends advanced_testcase {
*/
public function test_get_config_valid_keys($values, $key, $default, $tourconfig, $isforced, $forcedvalue, $expected) {
$step = $this->getMockBuilder(\tool_usertours\step::class)
->setMethods(['get_target', 'get_targettype', 'get_tour'])
->onlyMethods(['get_target', 'get_targettype', 'get_tour'])
->getMock();
$rc = new \ReflectionClass(\tool_usertours\step::class);
......@@ -494,7 +494,7 @@ class step_testcase extends advanced_testcase {
*/
public function test_persist_non_dirty() {
$step = $this->getMockBuilder(\tool_usertours\step::class)
->setMethods([
->onlyMethods([
'to_record',
'reload',
])
......@@ -525,7 +525,7 @@ class step_testcase extends advanced_testcase {
// Mock the tour.
$step = $this->getMockBuilder(\tool_usertours\step::class)
->setMethods([
->onlyMethods([
'to_record',
'calculate_sortorder',
'reload',
......@@ -574,7 +574,7 @@ class step_testcase extends advanced_testcase {
// Mock the tour.
$step = $this->getMockBuilder(\tool_usertours\step::class)
->setMethods([
->onlyMethods([
'to_record',
'calculate_sortorder',
'reload',
......@@ -616,7 +616,7 @@ class step_testcase extends advanced_testcase {
// Mock the tour.
$step = $this->getMockBuilder(\tool_usertours\step::class)
->setMethods([
->onlyMethods([
'to_record',
'calculate_sortorder',
'reload',
......@@ -668,7 +668,7 @@ class step_testcase extends advanced_testcase {
// Mock the tour.
$step = $this->getMockBuilder(\tool_usertours\step::class)
->setMethods([
->onlyMethods([
'to_record',
'calculate_sortorder',
'reload',
......@@ -707,7 +707,7 @@ class step_testcase extends advanced_testcase {
*/
public function test_remove_non_persisted() {
$step = $this->getMockBuilder(\tool_usertours\step::class)
->setMethods(null)
->onlyMethods([])
->getMock()
;
......@@ -727,7 +727,7 @@ class step_testcase extends advanced_testcase {
$id = rand(1, 100);
$tour = $this->getMockBuilder(\tool_usertours\tour::class)
->setMethods([
->onlyMethods([
'reset_step_sortorder',
])
->getMock()
......@@ -738,7 +738,7 @@ class step_testcase extends advanced_testcase {
;
$step = $this->getMockBuilder(\tool_usertours\step::class)
->setMethods([
->onlyMethods([
'get_tour',
])
->getMock()
......
......@@ -193,7 +193,7 @@ class tour_testcase extends advanced_testcase {
*/
public function test_persist_non_dirty() {
$tour = $this->getMockBuilder(tour::class)
->setMethods(['to_record'])
->onlyMethods(['to_record'])
->getMock()
;
......@@ -223,7 +223,7 @@ class tour_testcase extends advanced_testcase {
// Mock the tour.
$tour = $this->getMockBuilder(tour::class)
->setMethods([
->onlyMethods([
'to_record',
'reload',
])
......@@ -272,7 +272,7 @@ class tour_testcase extends advanced_testcase {
// Mock the tour.
$tour = $this->getMockBuilder(tour::class)
->setMethods([
->onlyMethods([
'to_record',
'reload',
])
......@@ -312,7 +312,7 @@ class tour_testcase extends advanced_testcase {
// Mock the tour.
$tour = $this->getMockBuilder(tour::class)
->setMethods([
->onlyMethods([
'to_record',
'reload',
])
......@@ -360,7 +360,7 @@ class tour_testcase extends advanced_testcase {
// Mock the tour.
$tour = $this->getMockBuilder(tour::class)
->setMethods([
->onlyMethods([
'to_record',
'reload',
])
......@@ -518,7 +518,7 @@ class tour_testcase extends advanced_testcase {
*/
public function test_remove_non_persisted() {
$tour = $this->getMockBuilder(tour::class)
->setMethods([
->onlyMethods([
'get_steps',
])
->getMock()
......@@ -544,7 +544,7 @@ class tour_testcase extends advanced_testcase {
$id = rand(1, 100);
$tour = $this->getMockBuilder(tour::class)
->setMethods([
->onlyMethods([
'get_steps',
])
->getMock()
......@@ -556,7 +556,7 @@ class tour_testcase extends advanced_testcase {
$rcp->setValue($tour, $id);
$step = $this->getMockBuilder(\tool_usertours\step::class)
->setMethods([
->onlyMethods([
'remove',
])
->getMock()
......@@ -683,7 +683,7 @@ class tour_testcase extends advanced_testcase {
$this->setAdminUser();
$tour = $this->getMockBuilder(tour::class)
->setMethods([
->onlyMethods([
'get_id',
'get_config',
'is_enabled',
......@@ -781,7 +781,7 @@ class tour_testcase extends advanced_testcase {
$this->setAdminUser();
$tour = $this->getMockBuilder(tour::class)
->setMethods([
->onlyMethods([
'get_config',
'set_config',
'get_id',
......@@ -839,7 +839,7 @@ class tour_testcase extends advanced_testcase {
*/
public function test_requested_user_reset() {
$tour = $this->getMockBuilder(tour::class)
->setMethods([
->onlyMethods([
'get_id',
])
->getMock()
......@@ -863,7 +863,7 @@ class tour_testcase extends advanced_testcase {
*/
public function test_mark_user_completed() {
$tour = $this->getMockBuilder(tour::class)