From 8a8fe2e754f94f07a3d9f485943b3f5cbe6f5cd1 Mon Sep 17 00:00:00 2001 From: Alexander Van der Bellen Date: Thu, 28 Nov 2024 13:50:47 +0800 Subject: [PATCH] Fix assertObjectHasAttribute deprecation warning (Moodle 4.5 compatibility) --- tests/datasource_site_test.php | 6 +++--- tests/renderer_test.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/datasource_site_test.php b/tests/datasource_site_test.php index 62036b7..37fcb42 100644 --- a/tests/datasource_site_test.php +++ b/tests/datasource_site_test.php @@ -62,9 +62,9 @@ public function test_get_data() { $ds = new dssite($cms); $data = $ds->get_data(); - $this->assertObjectHasAttribute('fullname', $data); - $this->assertObjectHasAttribute('shortname', $data); - $this->assertObjectHasAttribute('wwwroot', $data); + $this->assertObjectHasProperty('fullname', $data); + $this->assertObjectHasProperty('shortname', $data); + $this->assertObjectHasProperty('wwwroot', $data); } /** diff --git a/tests/renderer_test.php b/tests/renderer_test.php index 426ae0d..6137614 100644 --- a/tests/renderer_test.php +++ b/tests/renderer_test.php @@ -67,7 +67,7 @@ public function test_get_data() { foreach (dsbase::BUILTIN_DATASOURCES as $ds) { $classname = 'mod_cms\\local\\datasource\\' . $ds; $attribute = $classname::get_shortname(); - $this->assertObjectHasAttribute($attribute, $data); + $this->assertObjectHasProperty($attribute, $data); $this->assertIsObject($data->$attribute); } }