This commit is contained in:
Andrew Nicols 2024-03-12 10:45:02 +08:00
commit 9cdc5850c5
No known key found for this signature in database
GPG Key ID: 6D1E3157C8CFBF14
134 changed files with 7 additions and 383 deletions

View File

@ -227,7 +227,6 @@ class core_adminpresets_generator extends \component_generator_base {
public function access_protected($object, string $property) {
$reflection = new ReflectionClass($object);
$property = $reflection->getProperty($property);
$property->setAccessible(true);
return $property->getValue($object);
}
@ -244,7 +243,6 @@ class core_adminpresets_generator extends \component_generator_base {
// Set method accessibility.
$method = new ReflectionMethod(manager::class, 'get_setting');
$method->setAccessible(true);
// Get the proper adminpresets_setting instance.
$settingpage = $adminroot->locate($category);

View File

@ -2079,7 +2079,6 @@ class expired_contexts_test extends \advanced_testcase {
$rc = new \ReflectionClass(\tool_dataprivacy\expired_contexts_manager::class);
$rcm = $rc->getMethod('get_progress');
$rcm->setAccessible(true);
$this->assertInstanceOf(\text_progress_trace::class, $rcm->invoke($manager));
}
@ -2094,7 +2093,6 @@ class expired_contexts_test extends \advanced_testcase {
$rc = new \ReflectionClass(\tool_dataprivacy\expired_contexts_manager::class);
$rcm = $rc->getMethod('get_progress');
$rcm->setAccessible(true);
$this->assertSame($mytrace, $rcm->invoke($manager));
}

View File

@ -41,7 +41,6 @@ class filtered_userlist_test extends \advanced_testcase {
$rc = new \ReflectionClass(\tool_dataprivacy\filtered_userlist::class);
$rcm = $rc->getMethod('set_userids');
$rcm->setAccessible(true);
$rcm->invoke($userlist, $initial);

View File

@ -84,7 +84,6 @@ class locale_test extends \advanced_testcase {
$loc = new locale();
$rc = new \ReflectionClass(locale::class);
$rm = $rc->getMethod('set_locale');
$rm->setAccessible(true);
// Capture current locale for later restore (funnily, using the set_locale() method itself.
$originallocale = $rm->invokeArgs($loc, [LC_ALL, 0]);

View File

@ -70,7 +70,6 @@ class manager_test extends advanced_testcase {
// We're testing a private method, so we need to setup reflector magic.
$method = new ReflectionMethod('\tool_licensemanager\manager', 'edit');
$method->setAccessible(true); // Allow accessing of private method.
$method->invoke($manager, \tool_licensemanager\manager::ACTION_UPDATE, $testlicense->shortname);
// Should not create a new license when updating an existing license.
@ -90,7 +89,6 @@ class manager_test extends advanced_testcase {
// We're testing a private method, so we need to setup reflector magic.
$method = new ReflectionMethod('\tool_licensemanager\manager', 'edit');
$method->setAccessible(true); // Allow accessing of private method.
// Attempt to update a license that doesn't exist.
$formdata = [
@ -111,7 +109,6 @@ class manager_test extends advanced_testcase {
// We're testing a private method, so we need to setup reflector magic.
$method = new ReflectionMethod('\tool_licensemanager\manager', 'edit');
$method->setAccessible(true); // Allow accessing of private method.
// Attempt to update a license without passing license shortname.
$formdata = [
@ -148,7 +145,6 @@ class manager_test extends advanced_testcase {
// We're testing a private method, so we need to setup reflector magic.
$method = new ReflectionMethod('\tool_licensemanager\manager', 'edit');
$method->setAccessible(true); // Allow accessing of private method.
$method->invoke($manager, \tool_licensemanager\manager::ACTION_CREATE, $formdata['shortname']);
// Should create a new license in database.
@ -180,7 +176,6 @@ class manager_test extends advanced_testcase {
// We're testing a private method, so we need to setup reflector magic.
$method = new ReflectionMethod('\tool_licensemanager\manager', 'change_license_order');
$method->setAccessible(true); // Allow accessing of private method.
$method->invoke($manager, \tool_licensemanager\manager::ACTION_MOVE_UP, 'cc-nc-4.0');
$licenseorder = array_keys(license_manager::get_licenses());

View File

@ -39,7 +39,6 @@ class factor_test extends \advanced_testcase {
$emailfactorclass = new \factor_email\factor('email');
$rc = new \ReflectionClass($emailfactorclass::class);
$rcm = $rc->getMethod('check_verification_code');
$rcm->setAccessible(true);
// Assigned email to be used in getting the email factor.
$USER->email = 'user@mail.com';
@ -76,7 +75,6 @@ class factor_test extends \advanced_testcase {
// Cleans up email records once MFA passed.
$rcm = $rc->getMethod('post_pass_state');
$rcm->setAccessible(true);
$rcm->invoke($emailfactorclass);
// Check if the email records have been deleted.

View File

@ -154,7 +154,6 @@ class factor_test extends \advanced_testcase {
// Check verification code.
$rcm = $rc->getMethod('check_verification_code');
$rcm->setAccessible(true);
$this->assertTrue($rcm->invoke($smsfactor, $secretcode));
// Test that calling the revoke on the generic type revokes all.

View File

@ -50,7 +50,6 @@ class factor_test extends \advanced_testcase {
set_config('expireovernight', 0, 'factor_token');
$method = new \ReflectionMethod($this->factor, 'calculate_expiry_time');
$method->setAccessible(true);
// Test that non-overnight timestamps are just exactly as configured.
// We don't need to care about 0 or negative ints, they will just make the cookie expire immediately.
@ -95,7 +94,6 @@ class factor_test extends \advanced_testcase {
public function test_calculate_expiry_time_for_overnight_expiry_with_one_day_expiry($timestamp) {
// Setup configuration.
$method = new \ReflectionMethod($this->factor, 'calculate_expiry_time');
$method->setAccessible(true);
set_config('expireovernight', 1, 'factor_token');
set_config('expiry', DAYSECS, 'factor_token');
@ -144,7 +142,6 @@ class factor_test extends \advanced_testcase {
public function test_calculate_expiry_time_for_overnight_expiry_with_two_day_expiry($timestamp) {
// Setup configuration.
$method = new \ReflectionMethod($this->factor, 'calculate_expiry_time');
$method->setAccessible(true);
set_config('expireovernight', 1, 'factor_token');
set_config('expiry', 2 * DAYSECS, 'factor_token');
@ -195,7 +192,6 @@ class factor_test extends \advanced_testcase {
public function test_calculate_expiry_time_for_overnight_expiry_with_three_hour_expiry($timestamp) {
// Setup configuration.
$method = new \ReflectionMethod($this->factor, 'calculate_expiry_time');
$method->setAccessible(true);
set_config('expireovernight', 1, 'factor_token');
set_config('expiry', 3 * HOURSECS, 'factor_token');
@ -240,7 +236,6 @@ class factor_test extends \advanced_testcase {
public function test_calculate_expiry_time_for_overnight_expiry_with_an_hour_expiry($timestamp) {
// Setup configuration.
$method = new \ReflectionMethod($this->factor, 'calculate_expiry_time');
$method->setAccessible(true);
set_config('expireovernight', 1, 'factor_token');
set_config('expiry', HOURSECS, 'factor_token');

View File

@ -42,7 +42,6 @@ class secret_manager_test extends \advanced_testcase {
// Mutate the sessionid using reflection.
$reflectedsessionid = new \ReflectionProperty($secman, 'sessionid');
$reflectedsessionid->setAccessible(true);
$reflectedsessionid->setValue($secman, 'fakesession');
$sec1 = $secman->create_secret(1800, false);
@ -97,7 +96,6 @@ class secret_manager_test extends \advanced_testcase {
// Let's make stuff public using reflection.
$reflectedscanner = new \ReflectionClass($secman);
$reflectedmethod = $reflectedscanner->getMethod('add_secret_to_db');
$reflectedmethod->setAccessible(true);
// Now add a secret and confirm it creates the correct record.
$reflectedmethod->invoke($secman, 'code', 1800);
@ -164,7 +162,6 @@ class secret_manager_test extends \advanced_testcase {
// Session locked code from the same session id.
// Mutate the sessionid using reflection.
$reflectedsessionid = new \ReflectionProperty($secman, 'sessionid');
$reflectedsessionid->setAccessible(true);
$reflectedsessionid->setValue($secman, 'fakesession');
$secret = $secman->create_secret(1800, true);
@ -227,7 +224,6 @@ class secret_manager_test extends \advanced_testcase {
$reflectedscanner = new \ReflectionClass($secman);
$reflectedmethod = $reflectedscanner->getMethod('has_active_secret');
$reflectedmethod->setAccessible(true);
// DB secrets.
$this->assertFalse($reflectedmethod->invoke($secman));
@ -244,7 +240,6 @@ class secret_manager_test extends \advanced_testcase {
// Now check a secret with session involvement.
// Mutate the sessionid using reflection.
$reflectedsessionid = new \ReflectionProperty($secman, 'sessionid');
$reflectedsessionid->setAccessible(true);
$reflectedsessionid->setValue($secman, 'fakesession');
$this->assertFalse($reflectedmethod->invoke($secman, true));

View File

@ -110,7 +110,6 @@ class manager_test extends \advanced_testcase {
$rc = new \ReflectionClass('\tool_usertours\manager');
$rcm = $rc->getMethod($function);
$rcm->setAccessible(true);
$this->expectException('moodle_exception');
$rcm->invokeArgs($manager, $arguments);
@ -186,7 +185,6 @@ class manager_test extends \advanced_testcase {
// Call protected method via reflection.
$class = new \ReflectionClass(\tool_usertours\manager::class);
$method = $class->getMethod('_move_tour');
$method->setAccessible(true);
$method->invokeArgs(null, [$tour, $direction]);
// Assert expected sortorder.

View File

@ -130,7 +130,6 @@ class step_test extends \advanced_testcase {
$rc = new \ReflectionClass(\tool_usertours\step::class);
$rcm = $rc->getMethod('fetch');
$rcm->setAccessible(true);
$id = rand(1, 100);
$this->assertEquals($retval, $rcm->invoke($step, 'fetch', $id));
@ -150,7 +149,6 @@ class step_test extends \advanced_testcase {
$rc = new \ReflectionClass(\tool_usertours\step::class);
$rcp = $rc->getProperty('dirty');
$rcp->setAccessible(true);
$this->assertTrue($rcp->getValue($step));
}
@ -234,7 +232,6 @@ class step_test extends \advanced_testcase {
$rc = new \ReflectionClass(\tool_usertours\step::class);
$rcp = $rc->getProperty('config');
$rcp->setAccessible(true);
$allvalues = (object) [
'some' => 'value',
@ -361,7 +358,6 @@ class step_test extends \advanced_testcase {
$rc = new \ReflectionClass(\tool_usertours\step::class);
$rcp = $rc->getProperty('config');
$rcp->setAccessible(true);
$rcp->setValue($step, $values);
$target = $this->getMockBuilder(\tool_usertours\local\target\base::class)
@ -465,7 +461,6 @@ class step_test extends \advanced_testcase {
$rc = new \ReflectionClass(\tool_usertours\step::class);
$rcp = $rc->getProperty('config');
$rcp->setAccessible(true);
$rcp->setValue($step, $initialvalues);
$target = $this->getMockBuilder(\tool_usertours\local\target\base::class)
@ -542,12 +537,10 @@ class step_test extends \advanced_testcase {
$rc = new \ReflectionClass(\tool_usertours\step::class);
$rcp = $rc->getProperty('dirty');
$rcp->setAccessible(true);
$rcp->setValue($step, true);
$tour = $this->createMock(\tool_usertours\tour::class);
$rcp = $rc->getProperty('tour');
$rcp->setAccessible(true);
$rcp->setValue($step, $tour);
$this->assertSame($step, $step->persist());
@ -592,7 +585,6 @@ class step_test extends \advanced_testcase {
$tour = $this->createMock(\tool_usertours\tour::class);
$rc = new \ReflectionClass(\tool_usertours\step::class);
$rcp = $rc->getProperty('tour');
$rcp->setAccessible(true);
$rcp->setValue($step, $tour);
$this->assertSame($step, $step->persist(true));
@ -633,16 +625,13 @@ class step_test extends \advanced_testcase {
$rc = new \ReflectionClass(\tool_usertours\step::class);
$rcp = $rc->getProperty('id');
$rcp->setAccessible(true);
$rcp->setValue($step, 42);
$rcp = $rc->getProperty('dirty');
$rcp->setAccessible(true);
$rcp->setValue($step, true);
$tour = $this->createMock(\tool_usertours\tour::class);
$rcp = $rc->getProperty('tour');
$rcp->setAccessible(true);
$rcp->setValue($step, $tour);
$this->assertSame($step, $step->persist());
@ -685,12 +674,10 @@ class step_test extends \advanced_testcase {
$rc = new \ReflectionClass(\tool_usertours\step::class);
$rcp = $rc->getProperty('id');
$rcp->setAccessible(true);
$rcp->setValue($step, 42);
$tour = $this->createMock(\tool_usertours\tour::class);
$rcp = $rc->getProperty('tour');
$rcp->setAccessible(true);
$rcp->setValue($step, $tour);
$this->assertSame($step, $step->persist(true));
@ -752,7 +739,6 @@ class step_test extends \advanced_testcase {
$rc = new \ReflectionClass(\tool_usertours\step::class);
$rcp = $rc->getProperty('id');
$rcp->setAccessible(true);
$rcp->setValue($step, $id);
$this->assertEquals($id, $step->get_id());
@ -810,7 +796,6 @@ class step_test extends \advanced_testcase {
$rc = new \ReflectionClass(\tool_usertours\step::class);
$rcp = $rc->getProperty($key);
$rcp->setAccessible(true);
$rcp->setValue($step, $value);
$getter = 'get_' . $key;

View File

@ -116,7 +116,6 @@ class tour_test extends \advanced_testcase {
$rc = new \ReflectionClass(\tool_usertours\tour::class);
$rcp = $rc->getProperty('dirty');
$rcp->setAccessible(true);
$this->assertTrue($rcp->getValue($tour));
}
@ -172,7 +171,6 @@ class tour_test extends \advanced_testcase {
$rc = new \ReflectionClass(tour::class);
$rcp = $rc->getProperty($key);
$rcp->setAccessible(true);
$rcp->setValue($tour, $value);
$getter = 'get_' . $key;
@ -233,13 +231,11 @@ class tour_test extends \advanced_testcase {
$rc = new \ReflectionClass(tour::class);
$rcp = $rc->getProperty('dirty');
$rcp->setAccessible(true);
$rcp->setValue($tour, true);
$this->assertSame($tour, $tour->persist());
$rcp = $rc->getProperty('id');
$rcp->setAccessible(true);
$this->assertEquals($id, $rcp->getValue($tour));
}
@ -283,7 +279,6 @@ class tour_test extends \advanced_testcase {
$rc = new \ReflectionClass(tour::class);
$rcp = $rc->getProperty('id');
$rcp->setAccessible(true);
$this->assertEquals($id, $rcp->getValue($tour));
}
@ -322,11 +317,9 @@ class tour_test extends \advanced_testcase {
$rc = new \ReflectionClass(tour::class);
$rcp = $rc->getProperty('id');
$rcp->setAccessible(true);
$rcp->setValue($tour, 42);
$rcp = $rc->getProperty('dirty');
$rcp->setAccessible(true);
$rcp->setValue($tour, true);
$this->assertSame($tour, $tour->persist());
@ -370,11 +363,9 @@ class tour_test extends \advanced_testcase {
$rc = new \ReflectionClass(tour::class);
$rcp = $rc->getProperty('id');
$rcp->setAccessible(true);
$rcp->setValue($tour, 42);
$rcp = $rc->getProperty('dirty');
$rcp->setAccessible(true);
$rcp->setValue($tour, true);
$this->assertSame($tour, $tour->persist(true));
@ -393,7 +384,6 @@ class tour_test extends \advanced_testcase {
$rc = new \ReflectionClass(tour::class);
$rcp = $rc->getProperty('config');
$rcp->setAccessible(true);
$this->assertEquals((object) [
'key' => 'value',
'another' => [
@ -410,7 +400,6 @@ class tour_test extends \advanced_testcase {
$rc = new \ReflectionClass(tour::class);
$rcp = $rc->getProperty('config');
$rcp->setAccessible(true);
$allvalues = (object) [
'some' => 'value',
@ -499,7 +488,6 @@ class tour_test extends \advanced_testcase {
$rc = new \ReflectionClass(tour::class);
$rcp = $rc->getProperty('config');
$rcp->setAccessible(true);
$rcp->setValue($tour, $values);
$this->assertEquals($expected, $tour->get_config($key, $default));
@ -544,7 +532,6 @@ class tour_test extends \advanced_testcase {
$rc = new \ReflectionClass(tour::class);
$rcp = $rc->getProperty('id');
$rcp->setAccessible(true);
$rcp->setValue($tour, $id);
$step = $this->getMockBuilder(\tool_usertours\step::class)
@ -923,7 +910,6 @@ class tour_test extends \advanced_testcase {
$rc = new \ReflectionClass(tour::class);
$rcp = $rc->getProperty('sortorder');
$rcp->setAccessible(true);
$rcp->setValue($tour, $sortorder);
$this->assertEquals($isfirst, $tour->is_first_tour());
@ -943,7 +929,6 @@ class tour_test extends \advanced_testcase {
$rc = new \ReflectionClass(tour::class);
$rcp = $rc->getProperty('sortorder');
$rcp->setAccessible(true);
$rcp->setValue($tour, $sortorder);
// The total will be calculated.
@ -969,7 +954,6 @@ class tour_test extends \advanced_testcase {
$rc = new \ReflectionClass(tour::class);
$rcp = $rc->getProperty('sortorder');
$rcp->setAccessible(true);
$rcp->setValue($tour, $sortorder);
// The total is provided.

View File

@ -78,7 +78,6 @@ class community_of_inquiry_activities_completed_by_testcase extends advanced_tes
));
$method = new ReflectionMethod($availabilityinfo, 'set_in_database');
$method->setAccessible(true);
$method->invoke($availabilityinfo, json_encode($structure));
$this->setUser($stu1);
@ -339,11 +338,9 @@ class community_of_inquiry_activities_completed_by_testcase extends advanced_tes
$class = new ReflectionClass($indicator);
$property = $class->getProperty('course');
$property->setAccessible(true);
$property->setValue($indicator, $course);
$method = new ReflectionMethod($indicator, 'get_activities');
$method->setAccessible(true);
return array($indicator, $method);
}

View File

@ -427,7 +427,6 @@ class model_test extends \advanced_testcase {
$modelconfig = new \core_analytics\model_config($this->model);
$method = new \ReflectionMethod('\\core_analytics\\model_config', 'export_model_data');
$method->setAccessible(true);
$modeldata = $method->invoke($modelconfig);

View File

@ -74,7 +74,6 @@ class backup_stepslib_test extends \advanced_testcase {
$reflection = new \ReflectionClass($step);
$method = $reflection->getMethod('define_structure');
$method->setAccessible(true);
$structure = $method->invoke($step);
$elements = $structure->get_final_elements();

View File

@ -77,7 +77,6 @@ class restore_gradebook_structure_step_test extends \advanced_testcase {
$rc = new \ReflectionClass('\restore_gradebook_structure_step');
$rcm = $rc->getMethod('rewrite_step_backup_file_for_legacy_freeze');
$rcm->setAccessible(true);
$rcm->invoke($restore, $filepath);
// Check the result.

View File

@ -116,11 +116,9 @@ class automated_backup_test extends \advanced_testcase {
$classobject = $this->backupcronautomatedhelper->return_this();
$method = new \ReflectionMethod('\backup_cron_automated_helper', 'get_courses');
$method->setAccessible(true); // Allow accessing of private method.
$courses = $method->invoke($classobject);
$method = new \ReflectionMethod('\backup_cron_automated_helper', 'check_and_push_automated_backups');
$method->setAccessible(true); // Allow accessing of private method.
$emailpending = $method->invokeArgs($classobject, [$courses, $admin]);
$this->expectOutputRegex('/Skipping course id ' . $this->course->id . ': Not scheduled for backup until/');
@ -145,7 +143,6 @@ class automated_backup_test extends \advanced_testcase {
$classobject = $this->backupcronautomatedhelper->return_this();
$method = new \ReflectionMethod('\backup_cron_automated_helper', 'get_courses');
$method->setAccessible(true); // Allow accessing of private method.
$courses = $method->invoke($classobject);
// Create this backup course.
@ -161,7 +158,6 @@ class automated_backup_test extends \advanced_testcase {
$DB->update_record('backup_courses', $backupcourse);
$method = new \ReflectionMethod('\backup_cron_automated_helper', 'check_and_push_automated_backups');
$method->setAccessible(true); // Allow accessing of private method.
$emailpending = $method->invokeArgs($classobject, [$courses, $admin]);
$this->assertTrue($emailpending);
@ -204,7 +200,6 @@ class automated_backup_test extends \advanced_testcase {
$nextstarttime = backup_cron_automated_helper::calculate_next_automated_backup(null, time());
$method = new \ReflectionMethod('\backup_cron_automated_helper', 'should_skip_course_backup');
$method->setAccessible(true); // Allow accessing of private method.
$skipped = $method->invokeArgs($classobject, [$backupcourse, $course, $nextstarttime]);
$this->assertTrue($skipped);
@ -239,7 +234,6 @@ class automated_backup_test extends \advanced_testcase {
$nextstarttime = backup_cron_automated_helper::calculate_next_automated_backup(null, time());
$method = new \ReflectionMethod('\backup_cron_automated_helper', 'should_skip_course_backup');
$method->setAccessible(true); // Allow accessing of private method.
$skipped = $method->invokeArgs($classobject, [$backupcourse, $course, $nextstarttime]);
$this->assertTrue($skipped);
@ -274,7 +268,6 @@ class automated_backup_test extends \advanced_testcase {
$nextstarttime = backup_cron_automated_helper::calculate_next_automated_backup(null, time());
$method = new \ReflectionMethod('\backup_cron_automated_helper', 'should_skip_course_backup');
$method->setAccessible(true); // Allow accessing of private method.
$skipped = $method->invokeArgs($classobject, [$backupcourse, $course, $nextstarttime]);
$this->assertTrue($skipped);
@ -298,7 +291,6 @@ class automated_backup_test extends \advanced_testcase {
// Create a backup task.
$method = new \ReflectionMethod('\backup_cron_automated_helper', 'push_course_backup_adhoc_task');
$method->setAccessible(true); // Allow accessing of private method.
$method->invokeArgs($classobject, [$backupcourse, $admin]);
// Delete course for this test.
@ -331,7 +323,6 @@ class automated_backup_test extends \advanced_testcase {
// Create a backup task.
$method = new \ReflectionMethod('\backup_cron_automated_helper', 'push_course_backup_adhoc_task');
$method->setAccessible(true); // Allow accessing of private method.
$method->invokeArgs($classobject, [$backupcourse, $admin]);
// Delete backup course for this test.

View File

@ -351,7 +351,6 @@ class restore_dbops_test extends \advanced_testcase {
$dbuser = $DB->get_record('user', ['id' => $dbuser->id]);
$method = (new \ReflectionClass('restore_dbops'))->getMethod('precheck_user');
$method->setAccessible(true);
$result = $method->invoke(null, $backupuser, $samesite, $siteid);
if (is_bool($result)) {

View File

@ -62,11 +62,9 @@ class restore_log_rule_test extends \basic_testcase {
$class = new \ReflectionClass('restore_log_rule');
$method = $class->getMethod('extract_tokens');
$method->setAccessible(true);
$tokens = $method->invoke($lr, $original);
$method = $class->getMethod('build_regexp');
$method->setAccessible(true);
$this->assertSame($expectation, $method->invoke($lr, $original, $tokens));
}
}

View File

@ -912,7 +912,6 @@ class badgeslib_test extends advanced_testcase {
core_badges_myprofile_navigation($tree, $this->user, $iscurrentuser, $course);
$reflector = new ReflectionObject($tree);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
$this->assertArrayHasKey('localbadges', $nodes->getValue($tree));
}
@ -935,7 +934,6 @@ class badgeslib_test extends advanced_testcase {
core_badges_myprofile_navigation($tree, $this->user, $iscurrentuser, $course);
$reflector = new ReflectionObject($tree);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
$this->assertArrayNotHasKey('localbadges', $nodes->getValue($tree));
}
@ -954,7 +952,6 @@ class badgeslib_test extends advanced_testcase {
core_badges_myprofile_navigation($tree, $this->user, $iscurrentuser, $this->course);
$reflector = new ReflectionObject($tree);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
$this->assertArrayHasKey('localbadges', $nodes->getValue($tree));
}

View File

@ -134,7 +134,6 @@ class manage_badge_action_bar_test extends \advanced_testcase {
$rc = new \ReflectionClass(manage_badge_action_bar::class);
$rcm = $rc->getMethod('generate_badge_navigation');
$rcm->setAccessible(true);
$content = $rcm->invoke($actionbar);
$this->assertEquals($expected, array_values($content));
}

View File

@ -39,7 +39,6 @@ class accessibility_review_test extends advanced_testcase {
public function test_get_toggle_link() {
$rc = new ReflectionClass(block_accessreview::class);
$rm = $rc->getMethod('get_toggle_link');
$rm->setAccessible(true);
$block = new block_accessreview();
$output = $rm->invoke($block);
@ -60,7 +59,6 @@ class accessibility_review_test extends advanced_testcase {
$rc = new ReflectionClass(block_accessreview::class);
$rm = $rc->getMethod('get_download_link');
$rm->setAccessible(true);
$block = new block_accessreview();
$this->setUser($user1);
@ -86,7 +84,6 @@ class accessibility_review_test extends advanced_testcase {
$rc = new ReflectionClass(block_accessreview::class);
$rm = $rc->getMethod('get_report_link');
$rm->setAccessible(true);
$block = new block_accessreview();
$this->setUser($user1);

View File

@ -175,7 +175,6 @@ class lib_test extends \advanced_testcase {
core_blog_myprofile_navigation($tree, $USER, $iscurrentuser, $course);
$reflector = new \ReflectionObject($tree);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
$this->assertArrayHasKey('blogs', $nodes->getValue($tree));
}
@ -197,7 +196,6 @@ class lib_test extends \advanced_testcase {
core_blog_myprofile_navigation($tree, $USER, $iscurrentuser, $course);
$reflector = new \ReflectionObject($tree);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
$this->assertArrayNotHasKey('blogs', $nodes->getValue($tree));
}
@ -220,7 +218,6 @@ class lib_test extends \advanced_testcase {
core_blog_myprofile_navigation($tree, $USER, $iscurrentuser, $course);
$reflector = new \ReflectionObject($tree);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
$this->assertArrayNotHasKey('blogs', $nodes->getValue($tree));
}

View File

@ -851,7 +851,6 @@ class cachestore_redis extends cache_store implements cache_is_key_aware, cache_
if (!empty($config->test_ttl)) {
$definition = clone $definition;
$property = (new ReflectionClass($definition))->getProperty('ttl');
$property->setAccessible(true);
$property->setValue($definition, 999);
}
$cache = new cachestore_redis('Redis test', $configuration);

View File

@ -2332,11 +2332,8 @@ class cache_test extends \advanced_testcase {
// We need to get the individual stores so as to set up the right behaviour here.
$ref = new \ReflectionClass('\cache');
$definitionprop = $ref->getProperty('definition');
$definitionprop->setAccessible(true);
$storeprop = $ref->getProperty('store');
$storeprop->setAccessible(true);
$loaderprop = $ref->getProperty('loader');
$loaderprop->setAccessible(true);
$definition = $definitionprop->getValue($cache);
$localstore = $storeprop->getValue($cache);
@ -2346,7 +2343,6 @@ class cache_test extends \advanced_testcase {
// Set the lock waiting time to 1 second so it doesn't take forever to run the test.
$ref = new \ReflectionClass('\cachestore_file');
$lockwaitprop = $ref->getProperty('lockwait');
$lockwaitprop->setAccessible(true);
$lockwaitprop->setValue($localstore, 1);
$lockwaitprop->setValue($sharedstore, 1);

View File

@ -80,7 +80,6 @@ class calendar_event_exporter_test extends \advanced_testcase {
->getMock();
$reflector = new \ReflectionClass($class);
$method = $reflector->getMethod('get_timestamp_min_limit');
$method->setAccessible(true);
$result = $method->invoke($mock, $starttime, $min);
$this->assertEquals($expected, $result['mindaytimestamp']);
@ -137,7 +136,6 @@ class calendar_event_exporter_test extends \advanced_testcase {
->getMock();
$reflector = new \ReflectionClass($class);
$method = $reflector->getMethod('get_timestamp_max_limit');
$method->setAccessible(true);
$result = $method->invoke($mock, $starttime, $max);
$this->assertEquals($expected, $result['maxdaytimestamp']);

View File

@ -124,7 +124,6 @@ class rrule_manager_test extends \advanced_testcase {
$reflectionclass = new \ReflectionClass($mang);
foreach ($props as $prop => $expectedval) {
$rcprop = $reflectionclass->getProperty($prop);
$rcprop->setAccessible(true);
$this->assertEquals($expectedval, $rcprop->getValue($mang));
}
}

View File

@ -281,7 +281,6 @@ class command_test extends \advanced_testcase {
);
$execute = new ReflectionMethod($instance, 'execute');
$execute->setAccessible(true);
$execute->invoke($instance, $command);
}

View File

@ -447,7 +447,6 @@ class matrix_client_test extends \advanced_testcase {
$rc = new \ReflectionClass($instance);
$rcm = $rc->getMethod('execute');
$rcm->setAccessible(true);
$result = $rcm->invoke($instance, $command);
$this->assertEquals(200, $result->getStatusCode());

View File

@ -568,7 +568,6 @@ class contentbank_test extends advanced_testcase {
// Replace protected singletoninstance reference (core_plugin_manager property) with mock object.
$ref = new \ReflectionProperty(\core_plugin_manager::class, 'singletoninstance');
$ref->setAccessible(true);
$ref->setValue(null, $pluginmanager);
// Return values of get_plugins_of_type method.
@ -592,7 +591,6 @@ class contentbank_test extends advanced_testcase {
// Get access to private property enabledcontenttypes.
$rc = new \ReflectionClass(\core_contentbank\contentbank::class);
$rcp = $rc->getProperty('enabledcontenttypes');
$rcp->setAccessible(true);
foreach ($contenttypesenabled as $contenttypename) {
$plugins["\\contenttype_$contenttypename\\contenttype"] = $contenttypename;

View File

@ -45,7 +45,6 @@ class baseactions_test extends \advanced_testcase {
private function get_base_reflection_method(baseactions $baseinstance, string $methodname): ReflectionMethod {
$reflectionclass = new \reflectionclass($baseinstance);
$method = $reflectionclass->getMethod($methodname);
$method->setAccessible(true);
return $method;
}

View File

@ -72,7 +72,6 @@ class category_hooks_test extends \advanced_testcase {
// This is used to overcome private constructor.
$reflected = new \ReflectionClass(\core_course_category::class);
$constructor = $reflected->getConstructor();
$constructor->setAccessible(true);
$constructor->invoke($mockcategory, $category->get_db_record());
return $mockcategory;

View File

@ -98,7 +98,6 @@ class course_image_cache_test extends \advanced_testcase {
public function test_get_image_url_from_overview_files_return_null_if_no_summary_files_in_the_course() {
$method = new ReflectionMethod(course_image::class, 'get_image_url_from_overview_files');
$cache = course_image::get_instance_for_cache(new cache_definition());
$method->setAccessible(true);
// Create course without files.
$course = $this->getDataGenerator()->create_course();
@ -111,7 +110,6 @@ class course_image_cache_test extends \advanced_testcase {
public function test_get_image_url_from_overview_files_returns_null_if_no_summary_images_in_the_course() {
$method = new ReflectionMethod(course_image::class, 'get_image_url_from_overview_files');
$cache = course_image::get_instance_for_cache(new cache_definition());
$method->setAccessible(true);
// Create course without image files.
$draftid2 = $this->fill_draft_area(['filename2.zip' => 'Test file contents2']);
@ -125,7 +123,6 @@ class course_image_cache_test extends \advanced_testcase {
public function test_get_image_url_from_overview_files_returns_url_if_there_is_a_summary_image() {
$method = new ReflectionMethod(course_image::class, 'get_image_url_from_overview_files');
$cache = course_image::get_instance_for_cache(new cache_definition());
$method->setAccessible(true);
// Create course without one image.
$draftid1 = $this->fill_draft_area(['filename1.jpg' => file_get_contents(__DIR__ . '/fixtures/image.jpg')]);
@ -140,7 +137,6 @@ class course_image_cache_test extends \advanced_testcase {
public function test_get_image_url_from_overview_files_returns_url_of_the_first_image_if_there_are_many_summary_images() {
$method = new ReflectionMethod(course_image::class, 'get_image_url_from_overview_files');
$cache = course_image::get_instance_for_cache(new cache_definition());
$method->setAccessible(true);
// Create course with two image files.
$draftid1 = $this->fill_draft_area([
@ -159,7 +155,6 @@ class course_image_cache_test extends \advanced_testcase {
public function test_get_image_url_from_overview_files_returns_url_of_the_first_image_if_there_are_many_summary_files() {
$method = new ReflectionMethod(course_image::class, 'get_image_url_from_overview_files');
$cache = course_image::get_instance_for_cache(new cache_definition());
$method->setAccessible(true);
// Create course with two image files and one zip file.
$draftid1 = $this->fill_draft_area([

View File

@ -413,7 +413,6 @@ class targets_test extends \advanced_testcase {
$class = new \ReflectionClass('\core\analytics\analyser\student_enrolments');
$method = $class->getMethod('get_all_samples');
$method->setAccessible(true);
list($sampleids, $samplesdata) = $method->invoke($analyser, $analysable);
$target->add_sample_data($samplesdata);
@ -448,7 +447,6 @@ class targets_test extends \advanced_testcase {
$class = new \ReflectionClass('\core\analytics\analyser\student_enrolments');
$method = $class->getMethod('get_all_samples');
$method->setAccessible(true);
list($sampleids, $samplesdata) = $method->invoke($analyser, $analysable);
$target->add_sample_data($samplesdata);
@ -456,7 +454,6 @@ class targets_test extends \advanced_testcase {
$reftarget = new \ReflectionObject($target);
$refmethod = $reftarget->getMethod('calculate_sample');
$refmethod->setAccessible(true);
if ($nullcalculation) {
$this->assertNull($refmethod->invoke($target, $sampleid, $analysable, $starttime, $endtime));
@ -532,7 +529,6 @@ class targets_test extends \advanced_testcase {
$class = new \ReflectionClass('\core\analytics\analyser\student_enrolments');
$method = $class->getMethod('get_all_samples');
$method->setAccessible(true);
list($sampleids, $samplesdata) = $method->invoke($analyser, $analysable);
$target->add_sample_data($samplesdata);
@ -540,7 +536,6 @@ class targets_test extends \advanced_testcase {
$class = new \ReflectionClass('\core_course\analytics\target\course_competencies');
$method = $class->getMethod('calculate_sample');
$method->setAccessible(true);
// Method calculate_sample() returns 1 when the user has not achieved all the competencies assigned to the course.
$this->assertEquals(1, $method->invoke($target, $sampleid, $analysable));
@ -630,14 +625,12 @@ class targets_test extends \advanced_testcase {
$class = new \ReflectionClass('\core\analytics\analyser\student_enrolments');
$method = $class->getMethod('get_all_samples');
$method->setAccessible(true);
list($sampleids, $samplesdata) = $method->invoke($analyser, $analysable);
$target->add_sample_data($samplesdata);
$class = new \ReflectionClass('\core_course\analytics\target\course_gradetopass');
$method = $class->getMethod('calculate_sample');
$method->setAccessible(true);
// Verify all the expectations are fulfilled.
foreach ($sampleids as $sampleid => $key) {

View File

@ -156,7 +156,6 @@ class core_customfield_generator extends component_generator_base {
$rc = new ReflectionClass(get_class($data));
$rcm = $rc->getMethod('get_form_element_name');
$rcm->setAccessible(true);
$formelementname = $rcm->invokeArgs($data, []);
$record = (object)[$formelementname => $value];
$data->instance_form_save($record);

View File

@ -513,7 +513,6 @@ class ldap_test extends \advanced_testcase {
// Use reflection to sneak a look at the plugin.
$rc = new \ReflectionClass('enrol_ldap_plugin');
$rcp = $rc->getProperty('userobjectclass');
$rcp->setAccessible(true);
// Fetch the current userobjectclass value.
$value = $rcp->getValue($instance);

View File

@ -477,7 +477,6 @@ class helper_test extends \advanced_testcase {
public function test_set_xpath($parameters, $expected) {
$helper = new \ReflectionClass('enrol_lti\\helper');
$function = $helper->getMethod('set_xpath');
$function->setAccessible(true);
$document = new \DOMDocument();
$document->load(realpath(__DIR__ . '/fixtures/input.xml'));
@ -502,7 +501,6 @@ class helper_test extends \advanced_testcase {
];
$helper = new \ReflectionClass('enrol_lti\\helper');
$function = $helper->getMethod('set_xpath');
$function->setAccessible(true);
$document = new \DOMDocument();
$document->load(realpath(__DIR__ . '/fixtures/input.xml'));

View File

@ -223,7 +223,6 @@ class converter_test extends advanced_testcase {
$converter->method('get_enabled_plugins')->willReturn([]);
$method = new ReflectionMethod(\core_files\converter::class, 'get_document_converter_classes');
$method->setAccessible(true);
$result = $method->invokeArgs($converter, ['docx', 'pdf']);
$this->assertEmpty($result);
}
@ -238,7 +237,6 @@ class converter_test extends advanced_testcase {
]);
$method = new ReflectionMethod(\core_files\converter::class, 'get_document_converter_classes');
$method->setAccessible(true);
$result = $method->invokeArgs($converter, ['docx', 'pdf']);
$this->assertEmpty($result);
}
@ -257,7 +255,6 @@ class converter_test extends advanced_testcase {
]);
$method = new ReflectionMethod(\core_files\converter::class, 'get_document_converter_classes');
$method->setAccessible(true);
$result = $method->invokeArgs($converter, ['docx', 'pdf']);
$this->assertEmpty($result);
}
@ -276,7 +273,6 @@ class converter_test extends advanced_testcase {
]);
$method = new ReflectionMethod(\core_files\converter::class, 'get_document_converter_classes');
$method->setAccessible(true);
$result = $method->invokeArgs($converter, ['docx', 'pdf']);
$this->assertEmpty($result);
}
@ -296,7 +292,6 @@ class converter_test extends advanced_testcase {
]);
$method = new ReflectionMethod(\core_files\converter::class, 'get_document_converter_classes');
$method->setAccessible(true);
$result = $method->invokeArgs($converter, ['docx', 'pdf']);
$this->assertCount(1, $result);
$this->assertNotFalse(array_search($classname, $result));
@ -681,7 +676,6 @@ class converter_test extends advanced_testcase {
*/
public function test_get_next_converter_no_converters() {
$rcm = new \ReflectionMethod(converter::class, 'get_next_converter');
$rcm->setAccessible(true);
$converter = new \core_files\converter();
$result = $rcm->invoke($converter, [], null);
@ -694,7 +688,6 @@ class converter_test extends advanced_testcase {
*/
public function test_get_next_converter_only_converters() {
$rcm = new \ReflectionMethod(converter::class, 'get_next_converter');
$rcm->setAccessible(true);
$converter = new converter();
$result = $rcm->invoke($converter, ['example'], 'example');
@ -707,7 +700,6 @@ class converter_test extends advanced_testcase {
*/
public function test_get_next_converter_last_converters() {
$rcm = new \ReflectionMethod(converter::class, 'get_next_converter');
$rcm->setAccessible(true);
$converter = new converter();
$result = $rcm->invoke($converter, ['foo', 'example'], 'example');
@ -720,7 +712,6 @@ class converter_test extends advanced_testcase {
*/
public function test_get_next_converter_middle_converters() {
$rcm = new \ReflectionMethod(converter::class, 'get_next_converter');
$rcm->setAccessible(true);
$converter = new converter();
$result = $rcm->invoke($converter, ['foo', 'bar', 'baz', 'example'], 'bar');
@ -733,7 +724,6 @@ class converter_test extends advanced_testcase {
*/
public function test_get_next_converter_first() {
$rcm = new \ReflectionMethod(converter::class, 'get_next_converter');
$rcm->setAccessible(true);
$converter = new converter();
$result = $rcm->invoke($converter, ['foo', 'bar', 'baz', 'example']);

View File

@ -69,7 +69,6 @@ class lib_test extends \advanced_testcase {
gradereport_user_myprofile_navigation($this->tree, $this->user, $iscurrentuser, $this->course);
$reflector = new \ReflectionObject($this->tree);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
$this->assertArrayHasKey('grade', $nodes->getValue($this->tree));
}
@ -84,7 +83,6 @@ class lib_test extends \advanced_testcase {
gradereport_user_myprofile_navigation($this->tree, $this->user, $iscurrentuser, $this->course);
$reflector = new \ReflectionObject($this->tree);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
$this->assertArrayNotHasKey('grade', $nodes->getValue($this->tree));
}
}

View File

@ -113,7 +113,6 @@ class editor_test extends advanced_testcase {
// Call the method. We need the id of the new H5P content.
$rc = new \ReflectionClass(player::class);
$rcp = $rc->getProperty('h5pid');
$rcp->setAccessible(true);
$h5pid = $rcp->getValue($h5pplayer);
$editor = new editor();
@ -122,7 +121,6 @@ class editor_test extends advanced_testcase {
// Check we get the H5P content.
$rc = new \ReflectionClass(editor::class);
$rcp = $rc->getProperty('oldcontent');
$rcp->setAccessible(true);
$oldcontent = $rcp->getValue($editor);
$core = (new factory)->get_core();
@ -130,7 +128,6 @@ class editor_test extends advanced_testcase {
// Check we get the file of the H5P content.
$rcp = $rc->getProperty('oldfile');
$rcp->setAccessible(true);
$oldfile = $rcp->getValue($editor);
$this->assertSame($file->get_contenthash(), $oldfile->get_contenthash());
@ -154,7 +151,6 @@ class editor_test extends advanced_testcase {
// Check that the library has the right value.
$rc = new \ReflectionClass(editor::class);
$rcp = $rc->getProperty('library');
$rcp->setAccessible(true);
$actual = $rcp->getValue($editor);
$this->assertSame($library, $actual);
@ -171,7 +167,6 @@ class editor_test extends advanced_testcase {
];
$rcp = $rc->getProperty('filearea');
$rcp->setAccessible(true);
$actual = $rcp->getValue($editor);
$this->assertEquals($expected, $actual);
@ -198,8 +193,6 @@ class editor_test extends advanced_testcase {
$rc = new \ReflectionClass(page_requirements_manager::class);
$rcp = $rc->getProperty('cssurls');
$rcp2 = $rc->getProperty('jsincludes');
$rcp->setAccessible(true);
$rcp2->setAccessible(true);
$actualcss = array_keys($rcp->getValue($PAGE->requires));
$actualjs = array_keys($rcp2->getValue($PAGE->requires)['head']);
$cachebuster = helper::get_cache_buster();

View File

@ -69,11 +69,9 @@ class file_storage_test extends \advanced_testcase {
// Get value of protected properties.
$h5p_fs_rc = new \ReflectionClass(file_storage::class);
$h5p_file_storage_context = $h5p_fs_rc->getProperty('context');
$h5p_file_storage_context->setAccessible(true);
$this->h5p_fs_context = $h5p_file_storage_context->getValue($this->h5p_file_storage);
$h5p_file_storage_fs = $h5p_fs_rc->getProperty('fs');
$h5p_file_storage_fs->setAccessible(true);
$this->h5p_fs_fs = $h5p_file_storage_fs->getValue($this->h5p_file_storage);
}
@ -625,7 +623,6 @@ class file_storage_test extends \advanced_testcase {
// Set get_file method accessibility.
$method = new ReflectionMethod(file_storage::class, 'get_file');
$method->setAccessible(true);
$contentfile = $method->invoke(new file_storage(), file_storage::CONTENT_FILEAREA, $h5pcontentid, $file);
@ -668,7 +665,6 @@ class file_storage_test extends \advanced_testcase {
// Set get_file method accessibility.
$method = new ReflectionMethod(file_storage::class, 'move_file');
$method->setAccessible(true);
$method->invoke(new file_storage(), $file, $h5pcontentid);

View File

@ -554,7 +554,6 @@ class core_h5p_generator extends \component_generator_base {
// Call the method. We need the id of the new H5P content.
$rc = new \ReflectionClass(player::class);
$rcp = $rc->getProperty('h5pid');
$rcp->setAccessible(true);
$h5pid = $rcp->getValue($h5pplayer);
// Get the info export file.

View File

@ -58,7 +58,6 @@ trait behat_named_selector {
// This is due to an API limitation in Mink.
$rc = new \ReflectionClass(\Behat\Mink\Selector\NamedSelector::class);
$r = $rc->getProperty('replacements');
$r->setAccessible(true);
$replacements = $r->getValue($this);
$selectorxpath = strtr($selector->get_combined_xpath(), $replacements);
@ -77,7 +76,6 @@ trait behat_named_selector {
// This is due to an API limitation in Mink.
$rc = new \ReflectionClass(\Behat\Mink\Selector\NamedSelector::class);
$r = $rc->getProperty('replacements');
$r->setAccessible(true);
$existing = $r->getValue($this);
$from = $replacement->get_from($component);

View File

@ -164,7 +164,6 @@ class core_scss extends \ScssPhp\ScssPhp\Compiler {
// We need to find the import path relative to the directory of the currently processed file.
$currentdirectory = new ReflectionProperty(\ScssPhp\ScssPhp\Compiler::class, 'currentDirectory');
$currentdirectory->setAccessible(true);
if ($path = $this->findImport($path, $currentdirectory->getValue($this))) {
if ($this->is_valid_file($path)) {

View File

@ -1885,7 +1885,6 @@ class ddl_test extends \database_driver_testcase {
$rc = new \ReflectionClass('moodle_database');
$rcm = $rc->getMethod('get_temp_tables_cache');
$rcm->setAccessible(true);
$metacachetemp = $rcm->invokeArgs($DB, []);
// Data of test_table0 should be removed from the cache.
@ -1896,7 +1895,6 @@ class ddl_test extends \database_driver_testcase {
$rc = new \ReflectionClass('moodle_database');
$rcm = $rc->getMethod('get_metacache');
$rcm->setAccessible(true);
$metacache = $rcm->invokeArgs($DB, []);
// Data of test_table2 should be intact.

View File

@ -117,7 +117,6 @@ class dml_mysqli_read_slave_test extends \base_testcase {
$rc = new \ReflectionClass(\mysqli_native_moodle_database::class);
$rcm = $rc->getMethod('insert_chunk_size');
$rcm->setAccessible(true);
$rcm->invoke($db2);
$this->assertGreaterThan($reads, $reads = $db2->perf_get_reads());
$this->assertGreaterThan($readsprimary, $readsprimary = $reads - $db2->perf_get_reads_slave());

View File

@ -500,7 +500,7 @@ class dml_test extends \database_driver_testcase {
$out = $fixture->four($sql);
$expected = <<<EOD
SELECT * FROM {users}
-- line 65 of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to ReflectionMethod->invoke()
-- line 64 of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to ReflectionMethod->invoke()
EOD;
$this->assertEquals($this->unix_to_os_dirsep($expected), $out);
@ -508,8 +508,8 @@ EOD;
$out = $fixture->four($sql);
$expected = <<<EOD
SELECT * FROM {users}
-- line 65 of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to ReflectionMethod->invoke()
-- line 74 of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to test_dml_sql_debugging_fixture->one()
-- line 64 of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to ReflectionMethod->invoke()
-- line 73 of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to test_dml_sql_debugging_fixture->one()
EOD;
$this->assertEquals($this->unix_to_os_dirsep($expected), $out);
@ -517,10 +517,10 @@ EOD;
$out = $fixture->four($sql);
$expected = <<<EOD
SELECT * FROM {users}
-- line 65 of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to ReflectionMethod->invoke()
-- line 74 of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to test_dml_sql_debugging_fixture->one()
-- line 83 of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to test_dml_sql_debugging_fixture->two()
-- line 92 of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to test_dml_sql_debugging_fixture->three()
-- line 64 of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to ReflectionMethod->invoke()
-- line 73 of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to test_dml_sql_debugging_fixture->one()
-- line 82 of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to test_dml_sql_debugging_fixture->two()
-- line 91 of /lib/dml/tests/fixtures/test_dml_sql_debugging_fixture.php: call to test_dml_sql_debugging_fixture->three()
-- line 517 of /lib/dml/tests/dml_test.php: call to test_dml_sql_debugging_fixture->four()
EOD;
$this->assertEquals($this->unix_to_os_dirsep($expected), $out);
@ -6371,7 +6371,6 @@ EOD;
$this->assertTrue(empty($cfg->dboptions['versionfromdb']));
$rc = new \ReflectionClass(\mysqli_native_moodle_database::class);
$rcm = $rc->getMethod('should_db_version_be_read_from_db');
$rcm->setAccessible(true);
$this->assertFalse($rcm->invokeArgs($DB, []));
['description' => $description, 'version' => $version] = $DB->get_server_info();

View File

@ -61,7 +61,6 @@ class test_dml_sql_debugging_fixture {
*/
public function one(string $sql) {
$method = new \ReflectionMethod($this->db, 'add_sql_debugging');
$method->setAccessible(true);
return $method->invoke($this->db, $sql);
}

View File

@ -53,7 +53,6 @@ trait test_moodle_read_slave_trait {
$this->prefix = 'test_'; // Default, not to leave empty.
$rcp = new ReflectionProperty(parent::class, 'wantreadslave');
$rcp->setAccessible(true);
$rcp->setValue($this, true);
$this->dbhwrite = $rw;

View File

@ -70,7 +70,6 @@ class mysqli_native_moodle_database_test extends \advanced_testcase {
$reflector = new ReflectionClass($db2);
$rp = $reflector->getProperty('mysqli');
$rp->setAccessible(true);
return $rp->getValue($db2);
}

View File

@ -89,7 +89,6 @@ class pgsql_native_moodle_database_test extends \advanced_testcase {
global $DB;
$reflector = new ReflectionClass($DB);
$property = $reflector->getProperty('inorequaluniqueindex');
$property->setAccessible(true);
return (int) $property->getValue($DB);
}
@ -390,7 +389,6 @@ class pgsql_native_moodle_database_test extends \advanced_testcase {
$reflector = new ReflectionClass($db2);
$rp = $reflector->getProperty('pgsql');
$rp->setAccessible(true);
return $rp->getValue($db2);
}

View File

@ -125,10 +125,8 @@ class sqlsrv_native_moodle_database_test extends \advanced_testcase {
$reflector = new \ReflectionObject($sqlsrv);
$method = $reflector->getMethod('add_no_lock_to_temp_tables');
$method->setAccessible(true);
$temptablesproperty = $reflector->getProperty('temptables');
$temptablesproperty->setAccessible(true);
$temptables = new temptables_tester();
$temptablesproperty->setValue($sqlsrv, $temptables);
@ -252,7 +250,6 @@ EOT
// The has_query_order_by static method is protected. Use Reflection to call the method.
$method = new \ReflectionMethod('sqlsrv_native_moodle_database', 'has_query_order_by');
$method->setAccessible(true);
$result = $method->invoke(null, $sql);
$this->assertSame($expectedresult, $result);
}

View File

@ -469,7 +469,6 @@ class external_api_test extends \advanced_testcase {
protected function get_context_from_params() {
$rc = new \ReflectionClass(external_api::class);
$method = $rc->getMethod('get_context_from_params');
$method->setAccessible(true);
return $method->invokeArgs(null, func_get_args());
}
}

View File

@ -218,7 +218,6 @@ class file_system_filedir_test extends \advanced_testcase {
->willReturn($expectedresult);
$method = new \ReflectionMethod(file_system_filedir::class, 'get_remote_path_from_hash');
$method->setAccessible(true);
$result = $method->invokeArgs($fs, [$contenthash]);
$this->assertEquals($expectedresult, $result);
@ -294,7 +293,6 @@ class file_system_filedir_test extends \advanced_testcase {
$fs = new file_system_filedir();
$method = new \ReflectionMethod(file_system_filedir::class, 'get_fulldir_from_hash');
$method->setAccessible(true);
$result = $method->invokeArgs($fs, array($hash));
$expectedpath = sprintf('%s/filedir/%s', $CFG->dataroot, $hashdir);
@ -326,7 +324,6 @@ class file_system_filedir_test extends \advanced_testcase {
$fs = new file_system_filedir();
$method = new \ReflectionMethod('file_system_filedir', 'get_fulldir_from_storedfile');
$method->setAccessible(true);
$result = $method->invokeArgs($fs, array($file));
$expectedpath = sprintf('%s/filedir/%s', $CFG->dataroot, $hashdir);
@ -345,7 +342,6 @@ class file_system_filedir_test extends \advanced_testcase {
*/
public function test_get_contentdir_from_hash($hash, $hashdir) {
$method = new \ReflectionMethod(file_system_filedir::class, 'get_contentdir_from_hash');
$method->setAccessible(true);
$fs = new file_system_filedir();
$result = $method->invokeArgs($fs, array($hash));
@ -365,7 +361,6 @@ class file_system_filedir_test extends \advanced_testcase {
*/
public function test_get_contentpath_from_hash($hash, $hashdir) {
$method = new \ReflectionMethod(file_system_filedir::class, 'get_contentpath_from_hash');
$method->setAccessible(true);
$fs = new file_system_filedir();
$result = $method->invokeArgs($fs, array($hash));
@ -389,7 +384,6 @@ class file_system_filedir_test extends \advanced_testcase {
$fs = new file_system_filedir();
$method = new \ReflectionMethod(file_system_filedir::class, 'get_trash_fullpath_from_hash');
$method->setAccessible(true);
$result = $method->invokeArgs($fs, array($hash));
$expectedpath = sprintf('%s/trashdir/%s/%s', $CFG->dataroot, $hashdir, $hash);
@ -411,7 +405,6 @@ class file_system_filedir_test extends \advanced_testcase {
$fs = new file_system_filedir();
$method = new \ReflectionMethod(file_system_filedir::class, 'get_trash_fulldir_from_hash');
$method->setAccessible(true);
$result = $method->invokeArgs($fs, array($hash));
$expectedpath = sprintf('%s/trashdir/%s', $CFG->dataroot, $hashdir);
@ -486,7 +479,6 @@ class file_system_filedir_test extends \advanced_testcase {
$fs = new file_system_filedir();
$method = new \ReflectionMethod(file_system_filedir::class, 'recover_file');
$method->setAccessible(true);
$result = $method->invokeArgs($fs, array($file));
// Test the output.
@ -526,7 +518,6 @@ class file_system_filedir_test extends \advanced_testcase {
$fs = new file_system_filedir();
$method = new \ReflectionMethod(file_system_filedir::class, 'recover_file');
$method->setAccessible(true);
$result = $method->invokeArgs($fs, array($file));
// Test the output.
@ -564,7 +555,6 @@ class file_system_filedir_test extends \advanced_testcase {
$fs = new file_system_filedir();
$method = new \ReflectionMethod(file_system_filedir::class, 'recover_file');
$method->setAccessible(true);
$result = $method->invokeArgs($fs, array($file));
// Test the output.
@ -601,7 +591,6 @@ class file_system_filedir_test extends \advanced_testcase {
$fs = new file_system_filedir();
$method = new \ReflectionMethod(file_system_filedir::class, 'recover_file');
$method->setAccessible(true);
$result = $method->invokeArgs($fs, array($file));
// Test the output.
@ -635,7 +624,6 @@ class file_system_filedir_test extends \advanced_testcase {
$fs = new file_system_filedir();
$method = new \ReflectionMethod(file_system_filedir::class, 'recover_file');
$method->setAccessible(true);
$result = $method->invokeArgs($fs, array($file));
// Test the output.
@ -675,7 +663,6 @@ class file_system_filedir_test extends \advanced_testcase {
$fs = new file_system_filedir();
$method = new \ReflectionMethod(file_system_filedir::class, 'recover_file');
$method->setAccessible(true);
$result = $method->invokeArgs($fs, array($file));
// Test the output.
@ -1092,7 +1079,6 @@ class file_system_filedir_test extends \advanced_testcase {
$fs = new file_system_filedir();
$method = new \ReflectionMethod(file_system_filedir::class, 'empty_trash');
$method->setAccessible(true);
$result = $method->invoke($fs);
$this->assertTrue($vfileroot->hasChild('filedir/0f/f3/' . $contenthash));

View File

@ -494,7 +494,6 @@ class file_system_test extends \advanced_testcase {
$contenthash = \file_storage::hash_from_string($filecontent);
$method = new \ReflectionMethod(file_system::class, 'is_file_removable');
$method->setAccessible(true);
$result = $method->invokeArgs(null, [$contenthash]);
$this->assertFalse($result);
}
@ -517,7 +516,6 @@ class file_system_test extends \advanced_testcase {
$DB->method('record_exists')->willReturn(true);
$method = new \ReflectionMethod(file_system::class, 'is_file_removable');
$method->setAccessible(true);
$result = $method->invokeArgs(null, [$contenthash]);
$this->assertFalse($result);
@ -541,7 +539,6 @@ class file_system_test extends \advanced_testcase {
$DB->method('record_exists')->willReturn(false);
$method = new \ReflectionMethod(file_system::class, 'is_file_removable');
$method->setAccessible(true);
$result = $method->invokeArgs(null, [$contenthash]);
$this->assertTrue($result);
@ -910,7 +907,6 @@ class file_system_test extends \advanced_testcase {
$fs = $this->get_testable_mock();
$method = new \ReflectionMethod(file_system::class, 'get_imageinfo_from_path');
$method->setAccessible(true);
$result = $method->invokeArgs($fs, [$filepath]);
$this->assertArrayHasKey('width', $result);
@ -932,7 +928,6 @@ class file_system_test extends \advanced_testcase {
$fs = $this->get_testable_mock();
$method = new \ReflectionMethod(file_system::class, 'get_imageinfo_from_path');
$method->setAccessible(true);
$result = $method->invokeArgs($fs, [$filepath]);
$this->assertFalse($result);
@ -949,7 +944,6 @@ class file_system_test extends \advanced_testcase {
$fs = $this->get_testable_mock();
$method = new \ReflectionMethod(file_system::class, 'get_imageinfo_from_path');
$method->setAccessible(true);
$result = $method->invokeArgs($fs, [$filepath]);
$this->assertArrayHasKey('width', $result);
@ -971,7 +965,6 @@ class file_system_test extends \advanced_testcase {
$fs = $this->get_testable_mock();
$method = new \ReflectionMethod(file_system::class, 'get_imageinfo_from_path');
$method->setAccessible(true);
$result = $method->invokeArgs($fs, [$filepath]);
$this->assertArrayHasKey('width', $result);
@ -993,7 +986,6 @@ class file_system_test extends \advanced_testcase {
$fs = $this->get_testable_mock();
$method = new \ReflectionMethod(file_system::class, 'get_imageinfo_from_path');
$method->setAccessible(true);
$result = $method->invokeArgs($fs, [$filepath]);
$this->assertArrayHasKey('width', $result);
@ -1015,7 +1007,6 @@ class file_system_test extends \advanced_testcase {
$fs = $this->get_testable_mock();
$method = new \ReflectionMethod(file_system::class, 'get_imageinfo_from_path');
$method->setAccessible(true);
$result = $method->invokeArgs($fs, [$filepath]);
$this->assertFalse($result);

View File

@ -973,7 +973,6 @@ class phpunit_util extends testing_util {
public static function call_internal_method($object, $methodname, array $params, $classname) {
$reflection = new \ReflectionClass($classname);
$method = $reflection->getMethod($methodname);
$method->setAccessible(true);
return $method->invokeArgs($object, $params);
}

View File

@ -54,11 +54,8 @@ class phpunit_dataset_test extends advanced_testcase {
// We need public properties to check the basis.
$dsref = new \ReflectionClass($ds);
$dstables = $dsref->getProperty('tables');
$dstables->setAccessible(true);
$dscolumns = $dsref->getProperty('columns');
$dscolumns->setAccessible(true);
$dsrows = $dsref->getProperty('rows');
$dsrows->setAccessible(true);
// Expectations.
$exptables = ['user', 'user2'];
@ -158,11 +155,8 @@ class phpunit_dataset_test extends advanced_testcase {
// We need public properties to check the basis.
$dsref = new \ReflectionClass($ds);
$dstables = $dsref->getProperty('tables');
$dstables->setAccessible(true);
$dscolumns = $dsref->getProperty('columns');
$dscolumns->setAccessible(true);
$dsrows = $dsref->getProperty('rows');
$dsrows->setAccessible(true);
// We are expecting an exception.
if (!empty($exception)) {
@ -251,11 +245,8 @@ class phpunit_dataset_test extends advanced_testcase {
// We need public properties to check the basis.
$dsref = new \ReflectionClass($ds);
$dstables = $dsref->getProperty('tables');
$dstables->setAccessible(true);
$dscolumns = $dsref->getProperty('columns');
$dscolumns->setAccessible(true);
$dsrows = $dsref->getProperty('rows');
$dsrows->setAccessible(true);
// We are expecting an exception.
if (!empty($exception)) {
@ -397,11 +388,8 @@ class phpunit_dataset_test extends advanced_testcase {
// We need public properties to check the basis.
$dsref = new \ReflectionClass($ds);
$dstables = $dsref->getProperty('tables');
$dstables->setAccessible(true);
$dscolumns = $dsref->getProperty('columns');
$dscolumns->setAccessible(true);
$dsrows = $dsref->getProperty('rows');
$dsrows->setAccessible(true);
// We are expecting an exception.
if (!empty($exception)) {
@ -491,11 +479,8 @@ class phpunit_dataset_test extends advanced_testcase {
// We need public properties to check the basis.
$dsref = new \ReflectionClass($ds);
$dstables = $dsref->getProperty('tables');
$dstables->setAccessible(true);
$dscolumns = $dsref->getProperty('columns');
$dscolumns->setAccessible(true);
$dsrows = $dsref->getProperty('rows');
$dsrows->setAccessible(true);
// We are expecting an exception.
if (!empty($exception)) {
@ -662,11 +647,8 @@ class phpunit_dataset_test extends advanced_testcase {
// We need public properties to check the basis.
$dsref = new \ReflectionClass($ds);
$dstables = $dsref->getProperty('tables');
$dstables->setAccessible(true);
$dscolumns = $dsref->getProperty('columns');
$dscolumns->setAccessible(true);
$dsrows = $dsref->getProperty('rows');
$dsrows->setAccessible(true);
// We are expecting an exception.
if (!empty($exception)) {

View File

@ -1965,7 +1965,6 @@ class accesslib_test extends advanced_testcase {
// the access.php works.
$mockedcomponent = new ReflectionClass(core_component::class);
$mockedplugins = $mockedcomponent->getProperty('plugins');
$mockedplugins->setAccessible(true);
$plugins = $mockedplugins->getValue();
$plugins['fake'] = [$pluginname => "{$CFG->dirroot}/lib/tests/fixtures/fakeplugins/$pluginname"];
$mockedplugins->setValue(null, $plugins);
@ -4877,7 +4876,6 @@ class accesslib_test extends advanced_testcase {
->getMock();
$rcp = new ReflectionProperty($context, '_path');
$rcp->setAccessible(true);
$rcp->setValue($context, $contextpath);
$comparisoncontext = $this->getMockBuilder(\context::class)
@ -4889,7 +4887,6 @@ class accesslib_test extends advanced_testcase {
->getMock();
$rcp = new ReflectionProperty($comparisoncontext, '_path');
$rcp->setAccessible(true);
$rcp->setValue($comparisoncontext, $testpath);
$this->assertEquals($expected, $context->is_parent_of($comparisoncontext, $testself));
@ -4986,7 +4983,6 @@ class accesslib_test extends advanced_testcase {
->getMock();
$rcp = new ReflectionProperty($context, '_path');
$rcp->setAccessible(true);
$rcp->setValue($context, $contextpath);
$comparisoncontext = $this->getMockBuilder(\context::class)
@ -4998,7 +4994,6 @@ class accesslib_test extends advanced_testcase {
->getMock();
$rcp = new ReflectionProperty($comparisoncontext, '_path');
$rcp->setAccessible(true);
$rcp->setValue($comparisoncontext, $testpath);
$this->assertEquals($expected, $context->is_child_of($comparisoncontext, $testself));

View File

@ -57,7 +57,6 @@ class analysers_test extends \advanced_testcase {
// Just 1 sample per course.
$class = new \ReflectionClass('\core\analytics\analyser\courses');
$method = $class->getMethod('get_all_samples');
$method->setAccessible(true);
list($sampleids, $samplesdata) = $method->invoke($analyser, $analysable);
$this->assertCount(1, $sampleids);
$sampleid = reset($sampleids);
@ -107,7 +106,6 @@ class analysers_test extends \advanced_testcase {
$class = new \ReflectionClass('\core\analytics\analyser\site_courses');
$method = $class->getMethod('get_all_samples');
$method->setAccessible(true);
list($sampleids, $samplesdata) = $method->invoke($analyser, $analysable);
$this->assertCount(3, $sampleids);
@ -159,7 +157,6 @@ class analysers_test extends \advanced_testcase {
$class = new \ReflectionClass('\core\analytics\analyser\student_enrolments');
$method = $class->getMethod('get_all_samples');
$method->setAccessible(true);
list($sampleids, $samplesdata) = $method->invoke($analyser, $analysable);
// Only students.
$this->assertCount(2, $sampleids);

View File

@ -109,7 +109,6 @@ class client_test extends advanced_testcase {
];
$method = new ReflectionMethod("core\oauth2\client", "map_userinfo_to_fields");
$method->setAccessible(true);
$issuer = new \core\oauth2\issuer(0);
$mockbuilder = $this->getMockBuilder('core\oauth2\client');

View File

@ -966,7 +966,6 @@ class completionlib_test extends advanced_testcase {
$completioninfo = new completion_info($this->course);
$method = new ReflectionMethod("completion_info", "get_other_cm_completion_data");
$method->setAccessible(true);
// Check that fetching data for a module with custom completion provides its info.
$choicecompletiondata = $method->invoke($completioninfo, $cmchoice, $user->id);
@ -1813,7 +1812,6 @@ class completionlib_test extends advanced_testcase {
// We're testing a private method, so we need to setup reflector magic.
$method = new ReflectionMethod($ccompletion, '_save');
$method->setAccessible(true); // Allow accessing of private method.
$completionid = $method->invoke($ccompletion);
$completions = $DB->get_records('course_completions');
$this->assertEquals(count($completions), 1);
@ -1821,7 +1819,6 @@ class completionlib_test extends advanced_testcase {
$ccompletion->id = 0;
$method = new ReflectionMethod($ccompletion, '_save');
$method->setAccessible(true); // Allow accessing of private method.
$completionid = $method->invoke($ccompletion);
$this->assertDebuggingCalled('Can not update data object, no id!');
$this->assertNull($completionid);

View File

@ -640,11 +640,9 @@ class component_test extends advanced_testcase {
*/
public function test_classloader($psr0, $psr4, $classname, $includedfiles): void {
$psr0namespaces = new ReflectionProperty('core_component', 'psr0namespaces');
$psr0namespaces->setAccessible(true);
$psr0namespaces->setValue(null, $psr0);
$psr4namespaces = new ReflectionProperty('core_component', 'psr4namespaces');
$psr4namespaces->setAccessible(true);
$psr4namespaces->setValue(null, $psr4);
core_component::classloader($classname);
@ -775,16 +773,13 @@ class component_test extends advanced_testcase {
*/
public function test_psr_classloader($psr0, $psr4, $classname, $file): void {
$psr0namespaces = new ReflectionProperty('core_component', 'psr0namespaces');
$psr0namespaces->setAccessible(true);
$psr0namespaces->setValue(null, $psr0);
$psr4namespaces = new ReflectionProperty('core_component', 'psr4namespaces');
$psr4namespaces->setAccessible(true);
$psr4namespaces->setValue(null, $psr4);
$component = new ReflectionClass('core_component');
$psrclassloader = $component->getMethod('psr_classloader');
$psrclassloader->setAccessible(true);
$returnvalue = $psrclassloader->invokeArgs(null, [$classname]);
// Normalise to forward slashes for testing comparison.
@ -845,7 +840,6 @@ class component_test extends advanced_testcase {
public function test_get_class_file($classname, $prefix, $path, $separators, $result): void {
$component = new ReflectionClass('core_component');
$psrclassloader = $component->getMethod('get_class_file');
$psrclassloader->setAccessible(true);
$file = $psrclassloader->invokeArgs(null, [$classname, $prefix, $path, $separators]);
$this->assertEquals($result, $file);

View File

@ -410,7 +410,6 @@ class core_renderer_template_exploit_test extends \advanced_testcase {
// Get the mustache engine from the renderer.
$reflection = new \ReflectionMethod($renderer, 'get_mustache');
$reflection->setAccessible(true);
$engine = $reflection->invoke($renderer);
// Swap the loader out with an array loader so that we can set some

View File

@ -227,7 +227,6 @@ class get_result_admintree_test extends externallib_advanced_testcase {
$root = $this->setup_admin_tree($settings);
$method = new ReflectionMethod(get_result_admintree::class, 'get_check_from_setting');
$method->setAccessible(true);
$result = $method->invoke(new get_result_admintree(), $searchid, $searchname, $root);

View File

@ -2061,7 +2061,6 @@ class testable_curl extends curl {
public function get_options() {
// Access to private property.
$rp = new \ReflectionProperty('curl', 'options');
$rp->setAccessible(true);
return $rp->getValue($this);
}
@ -2073,7 +2072,6 @@ class testable_curl extends curl {
public function set_options($options) {
// Access to private property.
$rp = new \ReflectionProperty('curl', 'options');
$rp->setAccessible(true);
$rp->setValue($this, $options);
}
@ -2107,7 +2105,6 @@ class testable_curl extends curl {
public function call_apply_opt($options = null) {
// Access to private method.
$rm = new \ReflectionMethod('curl', 'apply_opt');
$rm->setAccessible(true);
$ch = curl_init();
return $rm->invoke($this, $ch, $options);
}

View File

@ -44,7 +44,6 @@ class filestorage_zip_archive_test extends \advanced_testcase {
$ziparchive = new zip_archive();
$method = new \ReflectionMethod('zip_archive', 'mangle_pathname');
$method->setAccessible(true);
$result = $method->invoke($ziparchive, $string);
$this->assertSame($expected, $result);

View File

@ -57,12 +57,10 @@ class http_client_test extends \advanced_testcase {
return $object->$attributename;
}
$attribute->setAccessible(true);
try {
return $attribute->getValue($object);
} finally {
$attribute->setAccessible(false);
}
} catch (\ReflectionException $e) {
// Do nothing.

View File

@ -475,7 +475,6 @@ class medialib_test extends \advanced_testcase {
*/
public function get_players_test($manager) {
$method = new \ReflectionMethod("core_media_manager", "get_players");
$method->setAccessible(true);
$players = $method->invoke($manager);
$out = '';
foreach ($players as $player) {

View File

@ -54,10 +54,8 @@ class activity_packager_test extends \advanced_testcase {
// Fetch all backup task settings.
$rc = new \ReflectionClass(activity_packager::class);
$rcmgetbackup = $rc->getMethod('get_backup_controller');
$rcmgetbackup->setAccessible(true);
$controller = $rcmgetbackup->invoke($packager);
$rcmgetall = $rc->getMethod('get_all_task_settings');
$rcmgetall->setAccessible(true);
$tasksettings = $rcmgetall->invoke($packager, $controller);
// Fetch the default settings and grab an example value (setting_root_users).
@ -80,7 +78,6 @@ class activity_packager_test extends \advanced_testcase {
// Override the setting_root_users value, then re-fetch the settings to check the change is reflected.
$overridevalue = ($oldvalue == 1) ? 0 : 1;
$rcmoverridesetting = $rc->getMethod('override_task_setting');
$rcmoverridesetting->setAccessible(true);
$rcmoverridesetting->invoke($packager, $tasksettings, $testsettingname, $overridevalue);
$tasksettings = $rcmgetall->invoke($packager, $controller);
$rootsettings = $tasksettings[\backup_root_task::class];

View File

@ -95,7 +95,6 @@ class activity_sender_test extends \advanced_testcase {
// Set get_file method accessibility.
$method = new ReflectionMethod(activity_sender::class, 'prepare_share_contents');
$method->setAccessible(true);
// Test with invalid share format.
$this->expectException(\moodle_exception::class);
@ -157,7 +156,6 @@ class activity_sender_test extends \advanced_testcase {
// Set get_resource_description method accessibility.
$method = new ReflectionMethod(activity_sender::class, 'get_resource_description');
$method->setAccessible(true);
// Test the processed description.
$processeddescription = $method->invoke(new activity_sender(

View File

@ -49,10 +49,8 @@ class course_packager_test extends \advanced_testcase {
// Fetch all backup task settings.
$rc = new \ReflectionClass(course_packager::class);
$rcmgetbackup = $rc->getMethod('get_backup_controller');
$rcmgetbackup->setAccessible(true);
$controller = $rcmgetbackup->invoke($packager);
$rcmgetall = $rc->getMethod('get_all_task_settings');
$rcmgetall->setAccessible(true);
$tasksettings = $rcmgetall->invoke($packager, $controller);
// Fetch the default settings and grab an example value (setting_root_users).
@ -75,7 +73,6 @@ class course_packager_test extends \advanced_testcase {
// Override the setting_root_users value, then re-fetch the settings to check the change is reflected.
$overridevalue = ($oldvalue == 1) ? 0 : 1;
$rcmoverridesetting = $rc->getMethod('override_task_setting');
$rcmoverridesetting->setAccessible(true);
$rcmoverridesetting->invoke($packager, $tasksettings, $testsettingname, $overridevalue);
$tasksettings = $rcmgetall->invoke($packager, $controller);
$rootsettings = $tasksettings[\backup_root_task::class];

View File

@ -51,11 +51,9 @@ class course_partial_packager_test extends \advanced_testcase {
// Fetch all backup task settings.
$rc = new \ReflectionClass(course_partial_packager::class);
$rcmgetbackup = $rc->getMethod('get_backup_controller');
$rcmgetbackup->setAccessible(true);
$controller = $rcmgetbackup->invoke($packager);
$rcmremove = $rc->getMethod('remove_unselected_activities');
$rcmremove->setAccessible(true);
$rcmremove->invoke($packager, $controller);
// Fetch all backup task settings for asserting them.

View File

@ -95,7 +95,6 @@ class course_partial_sender_test extends \advanced_testcase {
// Set get_file method accessibility.
$method = new ReflectionMethod(course_partial_sender::class, 'prepare_share_contents');
$method->setAccessible(true);
$httpclient = new http_client();
$moodlenetclient = new moodlenet_client($httpclient, $this->mockoauthclient);
@ -151,7 +150,6 @@ class course_partial_sender_test extends \advanced_testcase {
// Set get_resource_description method accessibility.
$method = new ReflectionMethod(course_partial_sender::class, 'get_resource_description');
$method->setAccessible(true);
// Test the processed description.
$httpclient = new http_client();

View File

@ -90,7 +90,6 @@ class course_sender_test extends \advanced_testcase {
// Set get_file method accessibility.
$method = new ReflectionMethod(course_sender::class, 'prepare_share_contents');
$method->setAccessible(true);
// Test with invalid share format.
$this->expectException(\moodle_exception::class);
@ -158,7 +157,6 @@ class course_sender_test extends \advanced_testcase {
// Set get_resource_description method accessibility.
$method = new ReflectionMethod(course_sender::class, 'get_resource_description');
$method->setAccessible(true);
// Test the processed description.
$httpclient = new http_client();

View File

@ -66,7 +66,6 @@ class myprofilelib_test extends \advanced_testcase {
core_myprofile_navigation($this->tree, $this->user, $iscurrentuser, $this->course);
$reflector = new \ReflectionObject($this->tree);
$categories = $reflector->getProperty('categories');
$categories->setAccessible(true);
$cats = $categories->getValue($this->tree);
$this->assertArrayHasKey('contact', $cats);
$this->assertArrayHasKey('coursedetails', $cats);
@ -76,7 +75,6 @@ class myprofilelib_test extends \advanced_testcase {
$this->assertArrayHasKey('loginactivity', $cats);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
$this->assertArrayHasKey('fullprofile', $nodes->getValue($this->tree));
}
@ -92,7 +90,6 @@ class myprofilelib_test extends \advanced_testcase {
core_myprofile_navigation($this->tree, $this->user, $iscurrentuser, $this->course);
$reflector = new \ReflectionObject($this->tree);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
$this->assertArrayNotHasKey('fullprofile', $nodes->getValue($this->tree));
}
@ -106,7 +103,6 @@ class myprofilelib_test extends \advanced_testcase {
core_myprofile_navigation($this->tree, $this->user, $iscurrentuser, $this->course);
$reflector = new \ReflectionObject($this->tree);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
$this->assertArrayHasKey('editprofile', $nodes->getValue($this->tree));
}
@ -120,7 +116,6 @@ class myprofilelib_test extends \advanced_testcase {
core_myprofile_navigation($this->tree, $this->user, $iscurrentuser, $this->course);
$reflector = new \ReflectionObject($this->tree);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
$this->assertArrayHasKey('editprofile', $nodes->getValue($this->tree));
}
@ -134,7 +129,6 @@ class myprofilelib_test extends \advanced_testcase {
core_myprofile_navigation($this->tree, $this->user, $iscurrentuser, $this->course);
$reflector = new \ReflectionObject($this->tree);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
$this->assertArrayHasKey('preferences', $nodes->getValue($this->tree));
$this->assertArrayHasKey('loginas', $nodes->getValue($this->tree));
}
@ -151,7 +145,6 @@ class myprofilelib_test extends \advanced_testcase {
core_myprofile_navigation($this->tree, $this->user, $iscurrentuser, $this->course);
$reflector = new \ReflectionObject($this->tree);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
$this->assertArrayNotHasKey('loginas', $nodes->getValue($this->tree));
}
@ -189,7 +182,6 @@ class myprofilelib_test extends \advanced_testcase {
core_myprofile_navigation($this->tree, $this->user, $iscurrentuser, null);
$reflector = new \ReflectionObject($this->tree);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
foreach ($hiddenfields as $field) {
$this->assertArrayHasKey($field, $nodes->getValue($this->tree));
}
@ -214,7 +206,6 @@ class myprofilelib_test extends \advanced_testcase {
core_myprofile_navigation($this->tree, $this->user, $iscurrentuser, null);
$reflector = new \ReflectionObject($this->tree);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
foreach ($hiddenfields as $field) {
$this->assertArrayNotHasKey($field, $nodes->getValue($this->tree));
}
@ -262,7 +253,6 @@ class myprofilelib_test extends \advanced_testcase {
$reflector = new \ReflectionObject($this->tree);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
/** @var \core_user\output\myprofile\node[] $tree */
$tree = $nodes->getValue($this->tree);
@ -286,7 +276,6 @@ class myprofilelib_test extends \advanced_testcase {
core_myprofile_navigation($this->tree, $this->user, $iscurrentuser, null);
$reflector = new \ReflectionObject($this->tree);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
$this->assertArrayHasKey('firstaccess', $nodes->getValue($this->tree));
$this->assertArrayHasKey('lastaccess', $nodes->getValue($this->tree));
$this->assertArrayHasKey('lastip', $nodes->getValue($this->tree));
@ -305,7 +294,6 @@ class myprofilelib_test extends \advanced_testcase {
core_myprofile_navigation($this->tree, $this->user, $iscurrentuser, null);
$reflector = new \ReflectionObject($this->tree);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
$this->assertArrayNotHasKey('firstaccess', $nodes->getValue($this->tree));
$this->assertArrayNotHasKey('lastaccess', $nodes->getValue($this->tree));
$this->assertArrayNotHasKey('lastip', $nodes->getValue($this->tree));

View File

@ -168,7 +168,6 @@ class primary_test extends \advanced_testcase {
$CFG->custommenuitems = $config;
$output = new primary($PAGE);
$method = new ReflectionMethod('core\navigation\output\primary', 'get_custom_menu');
$method->setAccessible(true);
$renderer = $PAGE->get_renderer('core');
// We can't assert the value of each menuitem "moremenuid" property (because it's random).
@ -375,7 +374,6 @@ class primary_test extends \advanced_testcase {
$primary = new primary($PAGE);
$method = new ReflectionMethod('core\navigation\output\primary', 'get_primary_nav');
$method->setAccessible(true);
$dataprimary = $method->invoke($primary);
// Take this custom menu that would come from the setting custommenitems.
@ -395,7 +393,6 @@ class primary_test extends \advanced_testcase {
$datacustom = $this->get_custom_menu($custommenuitems);
$method = new ReflectionMethod('core\navigation\output\primary', 'merge_primary_and_custom');
$method->setAccessible(true);
$menucomplete = $method->invoke($primary, $dataprimary, $datacustom, $ismobile);
return $menucomplete;
}

View File

@ -126,7 +126,6 @@ class primary_test extends \advanced_testcase {
$primary = new primary($PAGE);
$method = new ReflectionMethod('core\navigation\views\primary', 'search_and_set_active_node');
$method->setAccessible(true);
$result = $method->invoke($primary, $node);

View File

@ -63,7 +63,6 @@ class secondary_test extends \advanced_testcase {
];
$method = new ReflectionMethod('core\navigation\views\secondary', 'get_leaf_nodes');
$method->setAccessible(true);
$sortednodes = $method->invoke($secondary, $secondary, $nodes);
foreach ($sortednodes as $order => $node) {
$this->assertEquals($expectednodes[$order], $node->key);
@ -216,7 +215,6 @@ class secondary_test extends \advanced_testcase {
$node = $this->get_tree_initilised_to_set_activate($seturl);
$secondary = new secondary($PAGE);
$method = new ReflectionMethod('core\navigation\views\secondary', 'active_node_scan');
$method->setAccessible(true);
$result = $method->invoke($secondary, $node);
@ -274,7 +272,6 @@ class secondary_test extends \advanced_testcase {
}
$method = new ReflectionMethod('core\navigation\views\secondary', 'force_nodes_into_more_menu');
$method->setAccessible(true);
$method->invoke($secondary, $defaultmoremenunodes, $maxdisplayednodes);
$actualmoremenunodes = [];
@ -465,7 +462,6 @@ class secondary_test extends \advanced_testcase {
$PAGE->set_url($selectedurl);
$secondary = new secondary($PAGE);
$method = new ReflectionMethod('core\navigation\views\secondary', 'nodes_match_current_url');
$method->setAccessible(true);
$response = $method->invoke($secondary, $node);
$this->assertSame($response->key ?? null, $expectednode);
@ -630,7 +626,6 @@ class secondary_test extends \advanced_testcase {
$secondary = new secondary($PAGE);
$method = new ReflectionMethod('core\navigation\views\secondary', 'get_node_with_first_action');
$method->setAccessible(true);
$response = $method->invoke($secondary, $selectednode, $selectednode);
$this->assertEquals($expected, $response);
}
@ -688,7 +683,6 @@ class secondary_test extends \advanced_testcase {
}
$method = new ReflectionMethod('core\navigation\views\secondary', 'add_external_nodes_to_secondary');
$method->setAccessible(true);
$method->invoke($secondary, $firstnode, $firstnode, $customparent);
$actualnodes = $separatenode ? $customparent->get_children_key_list() : $secondary->get_children_key_list();
@ -850,12 +844,10 @@ class secondary_test extends \advanced_testcase {
} else {
// Set the correct node as active.
$method = new ReflectionMethod('core\navigation\views\secondary', 'scan_for_active_node');
$method->setAccessible(true);
$method->invoke($secondary, $secondary);
}
$method = new ReflectionMethod('core\navigation\views\secondary', 'get_overflow_menu_data');
$method->setAccessible(true);
$response = $method->invoke($secondary);
if ($expectednull) {
$this->assertNull($response);

View File

@ -61,7 +61,6 @@ class language_menu_test extends \advanced_testcase {
$output = new language_menu($PAGE);
$method = new ReflectionMethod('\core\output\language_menu', 'export_for_template');
$method->setAccessible(true);
$renderer = $PAGE->get_renderer('core');
$response = $method->invoke($output, $renderer);

View File

@ -57,7 +57,6 @@ class participants_action_bar_test extends \advanced_testcase {
$PAGE->set_context($context);
$output = new participants_action_bar($course, $PAGE, null);
$method = new ReflectionMethod('\core\output\participants_action_bar', 'get_content_for_select');
$method->setAccessible(true);
$renderer = $PAGE->get_renderer('core');
$response = $method->invoke($output, $renderer);

View File

@ -155,7 +155,6 @@ class outputrequirementslib_test extends \advanced_testcase {
$CFG->slasharguments = $cfgslashargs;
$rc = new \ReflectionClass(\page_requirements_manager::class);
$rcm = $rc->getMethod('js_fix_url');
$rcm->setAccessible(true);
$requires = new \page_requirements_manager();
$actualmoodleurl = $rcm->invokeArgs($requires, [$moodleurl]);
$this->assertEquals($expected, $actualmoodleurl->out(false));
@ -239,7 +238,6 @@ class outputrequirementslib_test extends \advanced_testcase {
$CFG->slasharguments = $cfgslashargs;
$rc = new \ReflectionClass(\page_requirements_manager::class);
$rcm = $rc->getMethod('js_fix_url');
$rcm->setAccessible(true);
$requires = new \page_requirements_manager();
$actualmoodleurl = $rcm->invokeArgs($requires, [$url]);
$this->assertEquals($expected, $actualmoodleurl->out(false));
@ -316,7 +314,6 @@ class outputrequirementslib_test extends \advanced_testcase {
public function test_js_fix_url_coding_exception($url, string $exmessage) {
$rc = new \ReflectionClass(\page_requirements_manager::class);
$rcm = $rc->getMethod('js_fix_url');
$rcm->setAccessible(true);
$requires = new \page_requirements_manager();
$this->expectException(\coding_exception::class);
$this->expectExceptionMessage($exmessage);

View File

@ -916,7 +916,6 @@ class session_manager_test extends \advanced_testcase {
public function test_array_session_diff(array $a, array $b, array $expected) {
$class = new \ReflectionClass('\core\session\manager');
$method = $class->getMethod('array_session_diff');
$method->setAccessible(true);
$result = $method->invokeArgs(null, [$a, $b]);
$this->assertSame($expected, $result);

View File

@ -368,7 +368,6 @@ class session_redis_test extends \advanced_testcase {
$sess = new \core\session\redis();
$prop = new \ReflectionProperty(\core\session\redis::class, 'host');
$prop->setAccessible(true);
$this->assertEquals('tls://' . TEST_SESSION_REDIS_HOST, $prop->getValue($sess));
}
}

View File

@ -491,7 +491,6 @@ class setuplib_test extends \advanced_testcase {
// The \core\uuid::generate_uuid_via_pecl_uuid_extension static method is protected. Use Reflection to call the method.
$method = new \ReflectionMethod('\core\uuid', 'generate_uuid_via_pecl_uuid_extension');
$method->setAccessible(true);
$uuid = $method->invoke(null);
$this->assertTrue(self::is_valid_uuid_v4($uuid), "Invalid v4 uuid: '$uuid'");
}
@ -508,7 +507,6 @@ class setuplib_test extends \advanced_testcase {
// The \core\uuid::generate_uuid_via_random_bytes static method is protected. Use Reflection to call the method.
$method = new \ReflectionMethod('\core\uuid', 'generate_uuid_via_random_bytes');
$method->setAccessible(true);
$uuid = $method->invoke(null);
$this->assertTrue(self::is_valid_uuid_v4($uuid), "Invalid v4 uuid: '$uuid'");
}

View File

@ -180,7 +180,6 @@ class xhprof_test extends \advanced_testcase {
// Make moodle_xhprofrun::xhprof_topo_sort() accessible.
$reflection = new \ReflectionClass('\moodle_xhprofrun');
$method = $reflection->getMethod('xhprof_topo_sort');
$method->setAccessible(true);
// Sort the data.
$result = $method->invokeArgs(new \moodle_xhprofrun(), [$rundata]);
$this->assertIsArray($result);
@ -227,7 +226,6 @@ class xhprof_test extends \advanced_testcase {
// Make moodle_xhprofrun::reduce_run_data() accessible.
$reflection = new \ReflectionClass('\moodle_xhprofrun');
$method = $reflection->getMethod('reduce_run_data');
$method->setAccessible(true);
// Reduce the data.
$result = $method->invokeArgs(new \moodle_xhprofrun(), [$rundata]);
$this->assertIsArray($result);

View File

@ -51,7 +51,6 @@ class document_services_test extends advanced_testcase {
$this->getDataGenerator()->enrol_user($user->id, $course->id, 'student');
$method = new ReflectionMethod('\assignfeedback_editpdf\document_services', 'save_file');
$method->setAccessible(true);
$filearea = document_services::TMP_ROTATED_JPG_FILEAREA;
$content = 'some random content';
@ -82,7 +81,6 @@ class document_services_test extends advanced_testcase {
$this->getDataGenerator()->enrol_user($user->id, $course->id, 'student');
$method = new ReflectionMethod('\assignfeedback_editpdf\document_services', 'save_rotated_image_file');
$method->setAccessible(true);
$imagecontent = file_get_contents($CFG->dirroot . '/lib/filestorage/tests/fixtures/testimage.png');
$imageresource = imagecreatefromstring($imagecontent);

View File

@ -134,7 +134,6 @@ class downloader_test extends \advanced_testcase {
// Expose protected filelist attribute.
$rc = new \ReflectionClass(downloader::class);
$rcp = $rc->getProperty('filesforzipping');
$rcp->setAccessible(true);
// Add some replacements.
$search = ['PARTICIPANT', 'DEFAULTTEAM'];

View File

@ -168,7 +168,6 @@ class locallib_participants_test extends \advanced_testcase {
$rc = new \ReflectionClass('assign');
$rcm = $rc->getMethod('update_submission');
$rcm->setAccessible(true);
$rcm->invokeArgs($assign, [$submission, $user->id, true, false]);
$plugin = $assign->get_submission_plugin_by_type($type);

View File

@ -4015,7 +4015,6 @@ Anchor link 2:<a title=\"bananas\" href=\"../logo-240x60.gif\">Link text</a>
// Call fix_null_grades().
$method = new \ReflectionMethod(\assign::class, 'fix_null_grades');
$method->setAccessible(true);
$result = $method->invoke($assign);
$this->assertSame(true, $result);

View File

@ -49,27 +49,22 @@ trait subplugins_test_helper_trait {
$mockedcomponent = new ReflectionClass(core_component::class);
$mockedplugins = $mockedcomponent->getProperty('plugins');
$mockedplugins->setAccessible(true);
$plugins = $mockedplugins->getValue();
$plugins[extension::BBB_EXTENSION_PLUGIN_NAME] = [$pluginname => $bbbextpath . "/$pluginname"];
$mockedplugins->setValue(null, $plugins);
$mockedplugintypes = $mockedcomponent->getProperty('plugintypes');
$mockedplugintypes->setAccessible(true);
$pluginstypes = $mockedplugintypes->getValue();
$pluginstypes[extension::BBB_EXTENSION_PLUGIN_NAME] = $bbbextpath;
$mockedplugintypes->setValue(null, $pluginstypes);
$fillclassmap = $mockedcomponent->getMethod('fill_classmap_cache');
$fillclassmap->setAccessible(true);
$fillclassmap->invoke(null);
$fillfilemap = $mockedcomponent->getMethod('fill_filemap_cache');
$fillfilemap->setAccessible(true);
$fillfilemap->invoke(null);
$mockedsubplugins = $mockedcomponent->getProperty('subplugins');
$mockedsubplugins->setAccessible(true);
$subplugins = $mockedsubplugins->getValue();
$subplugins['mod_bigbluebuttonbn'][extension::BBB_EXTENSION_PLUGIN_NAME][] = $pluginname;
$mockedsubplugins->setValue(null, $subplugins);
@ -148,10 +143,8 @@ trait subplugins_test_helper_trait {
$mockedcomponent = new ReflectionClass(core_component::class);
// Here we reset the plugin caches.
$mockedplugintypes = $mockedcomponent->getProperty('plugintypes');
$mockedplugintypes->setAccessible(true);
$mockedplugintypes->setValue(null, null);
$fillclassmap = $mockedcomponent->getMethod('init');
$fillclassmap->setAccessible(true);
$fillclassmap->invoke(null);
// Now uninstall the plugin and clean everything up for other tests.

View File

@ -262,10 +262,8 @@ XPATH
$this->setup_fake_plugin("simple");
$mockedcomponent = new ReflectionClass(core_component::class);
$mockedplugintypes = $mockedcomponent->getProperty('plugintypes');
$mockedplugintypes->setAccessible(true);
$mockedplugintypes->setValue(null, null);
$init = $mockedcomponent->getMethod('init');
$init->setAccessible(true);
$init->invoke(null);
// I enable the plugin.
$manager = core_plugin_manager::resolve_plugininfo_class(\mod_bigbluebuttonbn\extension::BBB_EXTENSION_PLUGIN_NAME);

View File

@ -632,7 +632,6 @@ class instance_test extends advanced_testcase {
$instance = instance::get_from_instanceid($record->id);
$instancereflection = new \ReflectionClass($instance);
$getinstanceinforetriever = $instancereflection->getMethod('get_instance_info_retriever');
$getinstanceinforetriever->setAccessible(true);
$this->assertInstanceOf('\mod_bigbluebuttonbn\instance',
$getinstanceinforetriever->invoke($instance, $record->id, instance::IDTYPE_INSTANCEID));
$this->assertEquals($cm->id, $instance->get_cm_id());

View File

@ -432,7 +432,6 @@ class lib_test extends \advanced_testcase {
$form = new mod_bigbluebuttonbn_mod_form($data, 1, $bbactivitycm, $this->get_course());
$refclass = new ReflectionClass("mod_bigbluebuttonbn_mod_form");
$formprop = $refclass->getProperty('_form');
$formprop->setAccessible(true);
/* @var $mform MoodleQuickForm quickform object definition */
$mform = $formprop->getValue($form);

View File

@ -76,7 +76,6 @@ class extension_test extends \advanced_testcase {
// Make the method public so we can test it.
$reflectionextension = new \ReflectionClass(extension::class);
$getclassimplementing = $reflectionextension->getMethod('get_instances_implementing');
$getclassimplementing->setAccessible(true);
$allfoundinstances = $getclassimplementing->invoke(null, $apiclass);
$foundclasses = array_map(
function($instance) {

View File

@ -86,7 +86,6 @@ class proxy_base_test extends \advanced_testcase {
protected static function get_status() {
$rc = new \ReflectionClass(proxy_base::class);
$rcm = $rc->getMethod('fetch_endpoint_xml');
$rcm->setAccessible(true);
return $rcm->invoke(null, '');
}
}

View File

@ -54,7 +54,6 @@ class base_send_notification_test extends advanced_testcase {
$rc = new \ReflectionClass(base_send_notification::class);
$rcm = $rc->getMethod('get_instance');
$rcm->setAccessible(true);
$instance = $rcm->invoke($stub);
$this->assertEquals($instancedata->id, $instance->get_instance_id());

View File

@ -3347,7 +3347,6 @@ function data_presets_generate_xml($course, $cm, $data) {
$preset = preset::create_from_instance($manager, $data->name);
$reflection = new \ReflectionClass(preset::class);
$method = $reflection->getMethod('generate_preset_xml');
$method->setAccessible(true);
return $method->invokeArgs($preset, []);
}

View File

@ -567,7 +567,6 @@ class preset_test extends \advanced_testcase {
// Make accessible the method.
$reflection = new \ReflectionClass(preset::class);
$method = $reflection->getMethod('generate_preset_xml');
$method->setAccessible(true);
// The method should return empty string when trying to generate preset.xml for a plugin preset.
$preset = preset::create_from_plugin(null, 'imagegallery');

View File

@ -58,7 +58,6 @@ class item_test extends advanced_testcase {
$itemclass = feedback_get_item_class('textarea');
$reflection = new ReflectionClass($itemclass);
$method = $reflection->getMethod('get_analysed');
$method->setAccessible(true);
// Call the method and indicate it is being used for Excel.
$actual = $method->invoke(new $itemclass(), $item, false, $course->id, true);

View File

@ -2866,7 +2866,6 @@ class lib_test extends \advanced_testcase {
mod_forum_myprofile_navigation($tree, $user, $iscurrentuser, $course);
$reflector = new \ReflectionObject($tree);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
$this->assertArrayHasKey('forumposts', $nodes->getValue($tree));
$this->assertArrayHasKey('forumdiscussions', $nodes->getValue($tree));
}
@ -2891,7 +2890,6 @@ class lib_test extends \advanced_testcase {
mod_forum_myprofile_navigation($tree, $USER, $iscurrentuser, $course);
$reflector = new \ReflectionObject($tree);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
$this->assertArrayNotHasKey('forumposts', $nodes->getValue($tree));
$this->assertArrayNotHasKey('forumdiscussions', $nodes->getValue($tree));
}
@ -2916,7 +2914,6 @@ class lib_test extends \advanced_testcase {
mod_forum_myprofile_navigation($tree, $user, $iscurrentuser, $course);
$reflector = new \ReflectionObject($tree);
$nodes = $reflector->getProperty('nodes');
$nodes->setAccessible(true);
$this->assertArrayHasKey('forumposts', $nodes->getValue($tree));
$this->assertArrayHasKey('forumdiscussions', $nodes->getValue($tree));
}

Some files were not shown because too many files have changed in this diff Show More