mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 13:38:32 +01:00
MDL-81281 phpunit: assertObjectNotHasAttribute is deprecated
To be integrated as part of MDL-81266 When running PHPUnit 9.6 we get the following deprecation warnings: "assertObjectNotHasAttribute() is deprecated and will be removed in PHPUnit 10. Refactor your test to use assertObjectNotHasProperty() instead." So we replace all instances of assertObjectNotHasAttribute with assertObjectNotHasProperty. PHPUnit justifies the change with: > PHPUnit currently refers to "fields" (see above) as "attributes". This > is (or will become) confusing considering the introduction of > attributes in PHP 8 and their support in PHPUnit. PHPUnit will be > changed to use the term "property" instead of "attribute" where "field" > is meant. Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
This commit is contained in:
parent
51bc492569
commit
87267da39d
@ -94,11 +94,11 @@ class provider_test extends provider_testcase {
|
||||
$prefs = writer::with_context($sysctx)->get_user_preferences('core_auth');
|
||||
$this->assertEquals(transform::yesno(false), $prefs->auth_forcepasswordchange->value);
|
||||
$this->assertEquals(transform::yesno(false), $prefs->create_password->value);
|
||||
$this->assertObjectNotHasAttribute('login_failed_count', $prefs);
|
||||
$this->assertObjectNotHasAttribute('login_failed_count_since_success', $prefs);
|
||||
$this->assertObjectNotHasAttribute('login_failed_last', $prefs);
|
||||
$this->assertObjectNotHasAttribute('login_lockout', $prefs);
|
||||
$this->assertObjectNotHasProperty('login_failed_count', $prefs);
|
||||
$this->assertObjectNotHasProperty('login_failed_count_since_success', $prefs);
|
||||
$this->assertObjectNotHasProperty('login_failed_last', $prefs);
|
||||
$this->assertObjectNotHasProperty('login_lockout', $prefs);
|
||||
$this->assertEquals(transform::yesno(true), $prefs->login_lockout_ignored->value);
|
||||
$this->assertObjectNotHasAttribute('login_lockout_secret', $prefs);
|
||||
$this->assertObjectNotHasProperty('login_lockout_secret', $prefs);
|
||||
}
|
||||
}
|
||||
|
@ -381,12 +381,12 @@ class provider_test extends provider_testcase {
|
||||
$this->assertEquals($yes, $prefs->block_is_hidden->value);
|
||||
|
||||
$prefs = writer::with_context($bprivatefiles->context)->get_user_context_preferences('core_block');
|
||||
$this->assertObjectNotHasAttribute('block_is_docked', $prefs);
|
||||
$this->assertObjectNotHasProperty('block_is_docked', $prefs);
|
||||
$this->assertEquals($no, $prefs->block_is_hidden->value);
|
||||
|
||||
$prefs = writer::with_context($bmyprofile->context)->get_user_context_preferences('core_block');
|
||||
$this->assertEquals($yes, $prefs->block_is_docked->value);
|
||||
$this->assertObjectNotHasAttribute('block_is_hidden', $prefs);
|
||||
$this->assertObjectNotHasProperty('block_is_hidden', $prefs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -720,7 +720,7 @@ class lib_test extends \advanced_testcase {
|
||||
|
||||
// Test custom fields are not returned if not needed.
|
||||
$result = cohort_get_cohort($cohort1->id, $coursectx);
|
||||
$this->assertObjectNotHasAttribute('customfields', $result);
|
||||
$this->assertObjectNotHasProperty('customfields', $result);
|
||||
|
||||
// Test cohort_get_cohorts.
|
||||
$result = cohort_get_cohorts(\context_system::instance()->id, 0, 25, '', true);
|
||||
@ -745,7 +745,7 @@ class lib_test extends \advanced_testcase {
|
||||
$this->assertEquals(2, $result['totalcohorts']);
|
||||
$this->assertEquals(2, $result['allcohorts']);
|
||||
foreach ($result['cohorts'] as $cohort) {
|
||||
$this->assertObjectNotHasAttribute('customfields', $cohort);
|
||||
$this->assertObjectNotHasProperty('customfields', $cohort);
|
||||
}
|
||||
|
||||
// Test test_cohort_get_all_cohorts.
|
||||
@ -771,7 +771,7 @@ class lib_test extends \advanced_testcase {
|
||||
$this->assertEquals(2, $result['totalcohorts']);
|
||||
$this->assertEquals(2, $result['allcohorts']);
|
||||
foreach ($result['cohorts'] as $cohort) {
|
||||
$this->assertObjectNotHasAttribute('customfields', $cohort);
|
||||
$this->assertObjectNotHasProperty('customfields', $cohort);
|
||||
}
|
||||
|
||||
// Test cohort_get_available_cohorts.
|
||||
@ -795,7 +795,7 @@ class lib_test extends \advanced_testcase {
|
||||
$result = cohort_get_available_cohorts($coursectx, COHORT_ALL, 0, 25, '');
|
||||
$this->assertCount(2, $result);
|
||||
foreach ($result as $cohort) {
|
||||
$this->assertObjectNotHasAttribute('customfields', $cohort);
|
||||
$this->assertObjectNotHasProperty('customfields', $cohort);
|
||||
}
|
||||
|
||||
// Test cohort_get_user_cohorts.
|
||||
@ -822,7 +822,7 @@ class lib_test extends \advanced_testcase {
|
||||
$result = cohort_get_user_cohorts($user->id);
|
||||
$this->assertCount(2, $result);
|
||||
foreach ($result as $cohort) {
|
||||
$this->assertObjectNotHasAttribute('customfields', $cohort);
|
||||
$this->assertObjectNotHasProperty('customfields', $cohort);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ class update_course_test extends \externallib_advanced_testcase {
|
||||
$update = $this->find_update($results, $expected['action'], 'cm', $activity->cmid);
|
||||
$this->assertNotEmpty($update);
|
||||
if ($expected['visible'] === null) {
|
||||
$this->assertObjectNotHasAttribute('visible', $update->fields);
|
||||
$this->assertObjectNotHasProperty('visible', $update->fields);
|
||||
} else {
|
||||
$this->assertEquals($expected['visible'], $update->fields->visible);
|
||||
}
|
||||
|
@ -176,31 +176,31 @@ class activitybadge_test extends \advanced_testcase {
|
||||
?array $extra = null
|
||||
): void {
|
||||
if (is_null($content)) {
|
||||
$this->assertObjectNotHasAttribute('badgecontent', $result);
|
||||
$this->assertObjectNotHasProperty('badgecontent', $result);
|
||||
} else {
|
||||
$this->assertEquals($content, $result->badgecontent);
|
||||
}
|
||||
|
||||
if (is_null($style)) {
|
||||
$this->assertObjectNotHasAttribute('badgestyle', $result);
|
||||
$this->assertObjectNotHasProperty('badgestyle', $result);
|
||||
} else {
|
||||
$this->assertEquals($style, $result->badgestyle);
|
||||
}
|
||||
|
||||
if (is_null($url)) {
|
||||
$this->assertObjectNotHasAttribute('badgeurl', $result);
|
||||
$this->assertObjectNotHasProperty('badgeurl', $result);
|
||||
} else {
|
||||
$this->assertEquals($url, $result->badgeurl);
|
||||
}
|
||||
|
||||
if (is_null($elementid)) {
|
||||
$this->assertObjectNotHasAttribute('badgeelementid', $result);
|
||||
$this->assertObjectNotHasProperty('badgeelementid', $result);
|
||||
} else {
|
||||
$this->assertEquals($elementid, $result->badgeelementid);
|
||||
}
|
||||
|
||||
if (is_null($extra)) {
|
||||
$this->assertObjectNotHasAttribute('badgeextraattributes', $result);
|
||||
$this->assertObjectNotHasProperty('badgeextraattributes', $result);
|
||||
} else {
|
||||
$this->assertEquals($extra, $result->badgeextraattributes);
|
||||
}
|
||||
|
@ -514,7 +514,7 @@ class tool_launch_service_test extends \lti_advantage_testcase {
|
||||
|
||||
// Instructors aren't subject to forceembed.
|
||||
$launchservice->user_launches_tool($instructoruser, $mockinstructorlaunch);
|
||||
$this->assertObjectNotHasAttribute('forcepagelayout', $SESSION);
|
||||
$this->assertObjectNotHasProperty('forcepagelayout', $SESSION);
|
||||
|
||||
// Learners are.
|
||||
$launchservice->user_launches_tool($learneruser, $mocklearnerlaunch);
|
||||
|
@ -296,7 +296,7 @@ class course_enrolment_manager_test extends \advanced_testcase {
|
||||
$this->assertEquals('Smart suit', $user->imagealt);
|
||||
|
||||
// But not some random other field like city.
|
||||
$this->assertObjectNotHasAttribute('city', $user);
|
||||
$this->assertObjectNotHasProperty('city', $user);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -330,7 +330,7 @@ class course_enrolment_manager_test extends \advanced_testcase {
|
||||
$this->assertEquals('Smart suit', $user->imagealt);
|
||||
|
||||
// But not some random other field like city.
|
||||
$this->assertObjectNotHasAttribute('city', $user);
|
||||
$this->assertObjectNotHasProperty('city', $user);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -367,7 +367,7 @@ class course_enrolment_manager_test extends \advanced_testcase {
|
||||
$this->assertEquals('Smart suit', $user->imagealt);
|
||||
|
||||
// But not some random other field like city.
|
||||
$this->assertObjectNotHasAttribute('city', $user);
|
||||
$this->assertObjectNotHasProperty('city', $user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -954,14 +954,14 @@ class enrollib_test extends advanced_testcase {
|
||||
// Check fields parameter still works. Fields default (certain base fields).
|
||||
$this->assertObjectHasAttribute('id', $courses[$course3->id]);
|
||||
$this->assertObjectHasAttribute('shortname', $courses[$course3->id]);
|
||||
$this->assertObjectNotHasAttribute('summary', $courses[$course3->id]);
|
||||
$this->assertObjectNotHasProperty('summary', $courses[$course3->id]);
|
||||
|
||||
// Specified fields (one, string).
|
||||
$courses = enrol_get_my_courses('summary', 'id', 0, [], true);
|
||||
$this->assertObjectHasAttribute('id', $courses[$course3->id]);
|
||||
$this->assertObjectHasAttribute('shortname', $courses[$course3->id]);
|
||||
$this->assertObjectHasAttribute('summary', $courses[$course3->id]);
|
||||
$this->assertObjectNotHasAttribute('summaryformat', $courses[$course3->id]);
|
||||
$this->assertObjectNotHasProperty('summaryformat', $courses[$course3->id]);
|
||||
|
||||
// Specified fields (two, string).
|
||||
$courses = enrol_get_my_courses('summary, summaryformat', 'id', 0, [], true);
|
||||
|
@ -120,7 +120,7 @@ class advanced_test extends \advanced_testcase {
|
||||
// Ensure session is reset after setUser, as it may contain extra info.
|
||||
$SESSION->sometestvalue = true;
|
||||
$this->setUser($user);
|
||||
$this->assertObjectNotHasAttribute('sometestvalue', $SESSION);
|
||||
$this->assertObjectNotHasProperty('sometestvalue', $SESSION);
|
||||
}
|
||||
|
||||
public function test_set_admin_user() {
|
||||
|
@ -76,7 +76,7 @@ class cron_test extends \advanced_testcase {
|
||||
$this->assertSame($user1->id, $USER->id);
|
||||
$this->assertSame($PAGE->context, \context_course::instance($SITE->id));
|
||||
$this->assertNotSame($adminsession, $SESSION);
|
||||
$this->assertObjectNotHasAttribute('test1', $SESSION);
|
||||
$this->assertObjectNotHasProperty('test1', $SESSION);
|
||||
$this->assertEmpty((array)$SESSION);
|
||||
$usersession1 = $SESSION;
|
||||
$SESSION->test2 = true;
|
||||
|
@ -418,7 +418,7 @@ class datalib_test extends \advanced_testcase {
|
||||
$this->assertSame('folder', $cm->modname);
|
||||
$this->assertSame($folder1a->id, $cm->instance);
|
||||
$this->assertSame($folder1a->course, $cm->course);
|
||||
$this->assertObjectNotHasAttribute('sectionnum', $cm);
|
||||
$this->assertObjectNotHasProperty('sectionnum', $cm);
|
||||
|
||||
$this->assertEquals($cm, get_coursemodule_from_id('', $folder1a->cmid));
|
||||
$this->assertEquals($cm, get_coursemodule_from_id('folder', $folder1a->cmid, $course1->id));
|
||||
@ -483,7 +483,7 @@ class datalib_test extends \advanced_testcase {
|
||||
$this->assertSame('folder', $cm->modname);
|
||||
$this->assertSame($folder1a->id, $cm->instance);
|
||||
$this->assertSame($folder1a->course, $cm->course);
|
||||
$this->assertObjectNotHasAttribute('sectionnum', $cm);
|
||||
$this->assertObjectNotHasProperty('sectionnum', $cm);
|
||||
|
||||
$this->assertEquals($cm, get_coursemodule_from_instance('folder', $folder1a->id, $course1->id));
|
||||
$this->assertEquals($cm, get_coursemodule_from_instance('folder', $folder1a->id, 0));
|
||||
@ -553,17 +553,17 @@ class datalib_test extends \advanced_testcase {
|
||||
$this->assertSame('folder', $cm->modname);
|
||||
$this->assertSame($folder1a->id, $cm->instance);
|
||||
$this->assertSame($folder1a->course, $cm->course);
|
||||
$this->assertObjectNotHasAttribute('sectionnum', $cm);
|
||||
$this->assertObjectNotHasAttribute('revision', $cm);
|
||||
$this->assertObjectNotHasAttribute('display', $cm);
|
||||
$this->assertObjectNotHasProperty('sectionnum', $cm);
|
||||
$this->assertObjectNotHasProperty('revision', $cm);
|
||||
$this->assertObjectNotHasProperty('display', $cm);
|
||||
|
||||
$cm = $modules[$folder1b->cmid];
|
||||
$this->assertSame('folder', $cm->modname);
|
||||
$this->assertSame($folder1b->id, $cm->instance);
|
||||
$this->assertSame($folder1b->course, $cm->course);
|
||||
$this->assertObjectNotHasAttribute('sectionnum', $cm);
|
||||
$this->assertObjectNotHasAttribute('revision', $cm);
|
||||
$this->assertObjectNotHasAttribute('display', $cm);
|
||||
$this->assertObjectNotHasProperty('sectionnum', $cm);
|
||||
$this->assertObjectNotHasProperty('revision', $cm);
|
||||
$this->assertObjectNotHasProperty('display', $cm);
|
||||
|
||||
$modules = get_coursemodules_in_course('folder', $course1->id, 'revision, display');
|
||||
$this->assertCount(2, $modules);
|
||||
@ -572,7 +572,7 @@ class datalib_test extends \advanced_testcase {
|
||||
$this->assertSame('folder', $cm->modname);
|
||||
$this->assertSame($folder1a->id, $cm->instance);
|
||||
$this->assertSame($folder1a->course, $cm->course);
|
||||
$this->assertObjectNotHasAttribute('sectionnum', $cm);
|
||||
$this->assertObjectNotHasProperty('sectionnum', $cm);
|
||||
$this->assertObjectHasAttribute('revision', $cm);
|
||||
$this->assertObjectHasAttribute('display', $cm);
|
||||
|
||||
@ -845,8 +845,8 @@ class datalib_test extends \advanced_testcase {
|
||||
$this->assertObjectHasAttribute('firstnamephonetic', $results[$userids[0]]);
|
||||
|
||||
// Should not have the custom field or department because no context specified.
|
||||
$this->assertObjectNotHasAttribute('department', $results[$userids[0]]);
|
||||
$this->assertObjectNotHasAttribute('profile_field_specialid', $results[$userids[0]]);
|
||||
$this->assertObjectNotHasProperty('department', $results[$userids[0]]);
|
||||
$this->assertObjectNotHasProperty('profile_field_specialid', $results[$userids[0]]);
|
||||
|
||||
// Check sorting.
|
||||
$results = get_users_listing('username', 'DESC');
|
||||
@ -867,8 +867,8 @@ class datalib_test extends \advanced_testcase {
|
||||
// specify a context AND have permissions.
|
||||
$results = get_users_listing('lastaccess', 'asc', 0, 0, '', '', '', '', null,
|
||||
\context_system::instance());
|
||||
$this->assertObjectNotHasAttribute('department', $results[$userids[0]]);
|
||||
$this->assertObjectNotHasAttribute('profile_field_specialid', $results[$userids[0]]);
|
||||
$this->assertObjectNotHasProperty('department', $results[$userids[0]]);
|
||||
$this->assertObjectNotHasProperty('profile_field_specialid', $results[$userids[0]]);
|
||||
$this->setAdminUser();
|
||||
$results = get_users_listing('lastaccess', 'asc', 0, 0, '', '', '', '', null,
|
||||
\context_system::instance());
|
||||
|
@ -214,36 +214,36 @@ class filetypes_test extends \advanced_testcase {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// The custom filetypes setting is empty to start with.
|
||||
$this->assertObjectNotHasAttribute('customfiletypes', $CFG);
|
||||
$this->assertObjectNotHasProperty('customfiletypes', $CFG);
|
||||
|
||||
// Add a custom filetype, then delete it.
|
||||
core_filetypes::add_type('frog', 'application/x-frog', 'document');
|
||||
$this->assertObjectHasAttribute('customfiletypes', $CFG);
|
||||
core_filetypes::delete_type('frog');
|
||||
$this->assertObjectNotHasAttribute('customfiletypes', $CFG);
|
||||
$this->assertObjectNotHasProperty('customfiletypes', $CFG);
|
||||
|
||||
// Change a standard filetype, then change it back.
|
||||
core_filetypes::update_type('asm', 'asm', 'text/plain', 'document');
|
||||
$this->assertObjectHasAttribute('customfiletypes', $CFG);
|
||||
core_filetypes::update_type('asm', 'asm', 'text/plain', 'sourcecode');
|
||||
$this->assertObjectNotHasAttribute('customfiletypes', $CFG);
|
||||
$this->assertObjectNotHasProperty('customfiletypes', $CFG);
|
||||
|
||||
// Delete a standard filetype, then add it back (the same).
|
||||
core_filetypes::delete_type('asm');
|
||||
$this->assertObjectHasAttribute('customfiletypes', $CFG);
|
||||
core_filetypes::add_type('asm', 'text/plain', 'sourcecode');
|
||||
$this->assertObjectNotHasAttribute('customfiletypes', $CFG);
|
||||
$this->assertObjectNotHasProperty('customfiletypes', $CFG);
|
||||
|
||||
// Revert a changed type.
|
||||
core_filetypes::update_type('asm', 'asm', 'text/plain', 'document');
|
||||
$this->assertObjectHasAttribute('customfiletypes', $CFG);
|
||||
core_filetypes::revert_type_to_default('asm');
|
||||
$this->assertObjectNotHasAttribute('customfiletypes', $CFG);
|
||||
$this->assertObjectNotHasProperty('customfiletypes', $CFG);
|
||||
|
||||
// Revert a deleted type.
|
||||
core_filetypes::delete_type('asm');
|
||||
$this->assertObjectHasAttribute('customfiletypes', $CFG);
|
||||
core_filetypes::revert_type_to_default('asm');
|
||||
$this->assertObjectNotHasAttribute('customfiletypes', $CFG);
|
||||
$this->assertObjectNotHasProperty('customfiletypes', $CFG);
|
||||
}
|
||||
}
|
||||
|
@ -3159,8 +3159,8 @@ EOF;
|
||||
$this->assertTimeCurrent($USER->currentlogin);
|
||||
$this->assertSame(sesskey(), $USER->sesskey);
|
||||
$this->assertTimeCurrent($USER->preference['_lastloaded']);
|
||||
$this->assertObjectNotHasAttribute('password', $USER);
|
||||
$this->assertObjectNotHasAttribute('description', $USER);
|
||||
$this->assertObjectNotHasProperty('password', $USER);
|
||||
$this->assertObjectNotHasProperty('description', $USER);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -105,8 +105,8 @@ class session_manager_test extends \advanced_testcase {
|
||||
\core\session\manager::set_user($user);
|
||||
|
||||
$this->assertEquals($user->id, $USER->id);
|
||||
$this->assertObjectNotHasAttribute('description', $user);
|
||||
$this->assertObjectNotHasAttribute('password', $user);
|
||||
$this->assertObjectNotHasProperty('description', $user);
|
||||
$this->assertObjectNotHasProperty('password', $user);
|
||||
$this->assertObjectHasAttribute('sesskey', $user);
|
||||
$this->assertSame($user, $GLOBALS['USER']);
|
||||
$this->assertSame($GLOBALS['USER'], $_SESSION['USER']);
|
||||
@ -124,8 +124,8 @@ class session_manager_test extends \advanced_testcase {
|
||||
@\core\session\manager::login_user($user); // Ignore header error messages.
|
||||
$this->assertEquals($user->id, $USER->id);
|
||||
|
||||
$this->assertObjectNotHasAttribute('description', $user);
|
||||
$this->assertObjectNotHasAttribute('password', $user);
|
||||
$this->assertObjectNotHasProperty('description', $user);
|
||||
$this->assertObjectNotHasProperty('password', $user);
|
||||
$this->assertSame($user, $GLOBALS['USER']);
|
||||
$this->assertSame($GLOBALS['USER'], $_SESSION['USER']);
|
||||
$this->assertSame($GLOBALS['USER'], $USER);
|
||||
@ -558,7 +558,7 @@ class session_manager_test extends \advanced_testcase {
|
||||
$_SESSION['extra'] = true;
|
||||
|
||||
// Try admin loginas this user in system context.
|
||||
$this->assertObjectNotHasAttribute('realuser', $USER);
|
||||
$this->assertObjectNotHasProperty('realuser', $USER);
|
||||
\core\session\manager::loginas($user->id, \context_system::instance());
|
||||
|
||||
$this->assertSame($user->id, $USER->id);
|
||||
|
@ -76,7 +76,7 @@ class sessionlib_test extends \advanced_testcase {
|
||||
$this->assertSame($user1->id, $USER->id);
|
||||
$this->assertSame($PAGE->context, \context_course::instance($SITE->id));
|
||||
$this->assertNotSame($adminsession, $SESSION);
|
||||
$this->assertObjectNotHasAttribute('test1', $SESSION);
|
||||
$this->assertObjectNotHasProperty('test1', $SESSION);
|
||||
$this->assertEmpty((array)$SESSION);
|
||||
$usersession1 = $SESSION;
|
||||
$SESSION->test2 = true;
|
||||
@ -261,7 +261,7 @@ class sessionlib_test extends \advanced_testcase {
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
|
||||
\core\session\manager::init_empty_session();
|
||||
$this->assertObjectNotHasAttribute('sesskey', $USER);
|
||||
$this->assertObjectNotHasProperty('sesskey', $USER);
|
||||
|
||||
$sesskey = sesskey();
|
||||
$this->assertNotEmpty($sesskey);
|
||||
|
@ -1568,7 +1568,7 @@ calendar,core_calendar|/calendar/view.php?view=month',
|
||||
public function test_moodle_start_upgrade_outageless() {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
$this->assertObjectNotHasAttribute('upgraderunning', $CFG);
|
||||
$this->assertObjectNotHasProperty('upgraderunning', $CFG);
|
||||
|
||||
// Confirm that starting normally sets the upgraderunning flag.
|
||||
upgrade_started();
|
||||
@ -1592,7 +1592,7 @@ calendar,core_calendar|/calendar/view.php?view=month',
|
||||
public function test_moodle_set_upgrade_timeout_outageless() {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
$this->assertObjectNotHasAttribute('upgraderunning', $CFG);
|
||||
$this->assertObjectNotHasProperty('upgraderunning', $CFG);
|
||||
|
||||
// Confirm running normally sets the timeout.
|
||||
upgrade_set_timeout(120);
|
||||
|
@ -174,7 +174,7 @@ class statement_test extends advanced_testcase {
|
||||
$this->assertObjectHasAttribute($extra, $data);
|
||||
$this->assertNotEmpty($data->$extra);
|
||||
} else {
|
||||
$this->assertObjectNotHasAttribute($extra, $data);
|
||||
$this->assertObjectNotHasProperty($extra, $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -308,7 +308,7 @@ class statement_test extends advanced_testcase {
|
||||
$this->assertObjectHasAttribute($extra, $data);
|
||||
$this->assertNotEmpty($data->object);
|
||||
} else {
|
||||
$this->assertObjectNotHasAttribute($extra, $data);
|
||||
$this->assertObjectNotHasProperty($extra, $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5209,7 +5209,7 @@ class api_test extends messagelib_test {
|
||||
$this->assertCount(1, (array) $customdata->actionbuttons);
|
||||
$this->assertObjectHasAttribute('placeholders', $customdata);
|
||||
$this->assertCount(1, (array) $customdata->placeholders);
|
||||
$this->assertObjectNotHasAttribute('notificationiconurl', $customdata); // No group image means no image.
|
||||
$this->assertObjectNotHasProperty('notificationiconurl', $customdata); // No group image means no image.
|
||||
|
||||
// Verify events. Note: the event is a message read event because of an if (PHPUNIT) conditional within message_send(),
|
||||
// however, we can still determine the number and ids of any recipients this way.
|
||||
|
@ -98,11 +98,11 @@ class custom_report_exporter_test extends advanced_testcase {
|
||||
], $export->attributes);
|
||||
|
||||
// The following are all generated by additional exporters, and should not be present when not editing.
|
||||
$this->assertObjectNotHasAttribute('sidebarmenucards', $export);
|
||||
$this->assertObjectNotHasAttribute('conditions', $export);
|
||||
$this->assertObjectNotHasAttribute('filters', $export);
|
||||
$this->assertObjectNotHasAttribute('sorting', $export);
|
||||
$this->assertObjectNotHasAttribute('cardview', $export);
|
||||
$this->assertObjectNotHasProperty('sidebarmenucards', $export);
|
||||
$this->assertObjectNotHasProperty('conditions', $export);
|
||||
$this->assertObjectNotHasProperty('filters', $export);
|
||||
$this->assertObjectNotHasProperty('sorting', $export);
|
||||
$this->assertObjectNotHasProperty('cardview', $export);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -391,7 +391,7 @@ class fields_test extends \advanced_testcase {
|
||||
$this->assertCount(2, $records);
|
||||
|
||||
// User id was renamed.
|
||||
$this->assertObjectNotHasAttribute('id', $records['XXX1']);
|
||||
$this->assertObjectNotHasProperty('id', $records['XXX1']);
|
||||
$this->assertObjectHasAttribute('userid', $records['XXX1']);
|
||||
|
||||
// Other fields are normal (just try a couple).
|
||||
@ -415,8 +415,8 @@ class fields_test extends \advanced_testcase {
|
||||
$this->assertCount(2, $records);
|
||||
|
||||
// User id was renamed.
|
||||
$this->assertObjectNotHasAttribute('id', $records['XXX1']);
|
||||
$this->assertObjectNotHasAttribute('u_id', $records['XXX1']);
|
||||
$this->assertObjectNotHasProperty('id', $records['XXX1']);
|
||||
$this->assertObjectNotHasProperty('u_id', $records['XXX1']);
|
||||
$this->assertObjectHasAttribute('userid', $records['XXX1']);
|
||||
|
||||
// Other fields are prefixed (just try a couple).
|
||||
|
@ -56,7 +56,7 @@ class profilelib_test extends \advanced_testcase {
|
||||
$this->assertArrayNotHasKey($id1, profile_get_custom_fields(true));
|
||||
|
||||
// Check that profile_user_record returns same (no) fields.
|
||||
$this->assertObjectNotHasAttribute('frogdesc', profile_user_record($user->id));
|
||||
$this->assertObjectNotHasProperty('frogdesc', profile_user_record($user->id));
|
||||
|
||||
// Check that profile_user_record returns all the fields when requested.
|
||||
$this->assertObjectHasAttribute('frogdesc', profile_user_record($user->id, false));
|
||||
|
@ -75,9 +75,9 @@ class userselector_test extends \advanced_testcase {
|
||||
|
||||
foreach ($selector->find_users('') as $found) {
|
||||
foreach ($found as $user) {
|
||||
$this->assertObjectNotHasAttribute('idnumber', $user);
|
||||
$this->assertObjectNotHasAttribute('country', $user);
|
||||
$this->assertObjectNotHasAttribute('city', $user);
|
||||
$this->assertObjectNotHasProperty('idnumber', $user);
|
||||
$this->assertObjectNotHasProperty('country', $user);
|
||||
$this->assertObjectNotHasProperty('city', $user);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -95,9 +95,9 @@ class userselector_test extends \advanced_testcase {
|
||||
|
||||
foreach ($systemselector->find_users('') as $found) {
|
||||
foreach ($found as $user) {
|
||||
$this->assertObjectNotHasAttribute('idnumber', $user);
|
||||
$this->assertObjectNotHasAttribute('country', $user);
|
||||
$this->assertObjectNotHasAttribute('city', $user);
|
||||
$this->assertObjectNotHasProperty('idnumber', $user);
|
||||
$this->assertObjectNotHasProperty('country', $user);
|
||||
$this->assertObjectNotHasProperty('city', $user);
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,8 +125,8 @@ class userselector_test extends \advanced_testcase {
|
||||
foreach ($courseselector->find_users('') as $found) {
|
||||
foreach ($found as $user) {
|
||||
$this->assertObjectHasAttribute('idnumber', $user);
|
||||
$this->assertObjectNotHasAttribute('country', $user);
|
||||
$this->assertObjectNotHasAttribute('city', $user);
|
||||
$this->assertObjectNotHasProperty('country', $user);
|
||||
$this->assertObjectNotHasProperty('city', $user);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -179,8 +179,8 @@ class userselector_test extends \advanced_testcase {
|
||||
foreach ($systemselector->find_users('') as $found) {
|
||||
foreach ($found as $user) {
|
||||
$this->assertObjectHasAttribute('idnumber', $user);
|
||||
$this->assertObjectNotHasAttribute('country', $user);
|
||||
$this->assertObjectNotHasAttribute('city', $user);
|
||||
$this->assertObjectNotHasProperty('country', $user);
|
||||
$this->assertObjectNotHasProperty('city', $user);
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,16 +210,16 @@ class userselector_test extends \advanced_testcase {
|
||||
foreach ($systemselector->find_users('') as $found) {
|
||||
foreach ($found as $user) {
|
||||
$this->assertObjectHasAttribute('idnumber', $user);
|
||||
$this->assertObjectNotHasAttribute('country', $user);
|
||||
$this->assertObjectNotHasAttribute('city', $user);
|
||||
$this->assertObjectNotHasProperty('country', $user);
|
||||
$this->assertObjectNotHasProperty('city', $user);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($courseselector->find_users('') as $found) {
|
||||
foreach ($found as $user) {
|
||||
$this->assertObjectHasAttribute('idnumber', $user);
|
||||
$this->assertObjectNotHasAttribute('country', $user);
|
||||
$this->assertObjectNotHasAttribute('city', $user);
|
||||
$this->assertObjectNotHasProperty('country', $user);
|
||||
$this->assertObjectNotHasProperty('city', $user);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -245,8 +245,8 @@ class userselector_test extends \advanced_testcase {
|
||||
$this->assertObjectHasAttribute('idnumber', $user);
|
||||
$this->assertObjectHasAttribute('country', $user);
|
||||
$this->assertObjectHasAttribute('city', $user);
|
||||
$this->assertObjectNotHasAttribute('email', $user);
|
||||
$this->assertObjectNotHasAttribute('department', $user);
|
||||
$this->assertObjectNotHasProperty('email', $user);
|
||||
$this->assertObjectNotHasProperty('department', $user);
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,8 +255,8 @@ class userselector_test extends \advanced_testcase {
|
||||
$this->assertObjectHasAttribute('idnumber', $user);
|
||||
$this->assertObjectHasAttribute('country', $user);
|
||||
$this->assertObjectHasAttribute('city', $user);
|
||||
$this->assertObjectNotHasAttribute('email', $user);
|
||||
$this->assertObjectNotHasAttribute('department', $user);
|
||||
$this->assertObjectNotHasProperty('email', $user);
|
||||
$this->assertObjectNotHasProperty('department', $user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user