The PHPUnit test suite is failing in the Moodle 5.1 environment because it calls assertObjectHasAttribute(), which has been removed in PHPUnit 10.
To maintain compatibility with Moodle 5.1 and newer PHPUnit versions, these calls must be updated to assertObjectHasProperty().
Error Logs
The following 4 errors were identified in:
There were 4 errors:
1) locallib_test::test_local_kaltura_format_lti_instance_object
Error: Call to undefined method locallib_test::assertObjectHasAttribute()
/home/runner/work/moodle/moodle/public/local/kaltura/tests/locallib_test.php:719
2) locallib_test::test_local_kaltura_log_data_logging_request_data
Error: Call to undefined method locallib_test::assertObjectHasAttribute()
/home/runner/work/moodle/moodle/public/local/kaltura/tests/locallib_test.php:849
3) locallib_test::test_local_kaltura_log_data_logging_response_data
Error: Call to undefined method locallib_test::assertObjectHasAttribute()
/home/runner/work/moodle/moodle/public/local/kaltura/tests/locallib_test.php:908
4) migrationlib_test::test_initialization_of_config_values
Error: Call to undefined method migrationlib_test::assertObjectHasAttribute()
/home/runner/work/moodle/moodle/public/local/kaltura/tests/migrationlib_test.php:47
Steps to Reproduce
Run the PHPUnit tests in a Moodle 5.1 environment:
vendor/bin/phpunit local/kaltura/tests/locallib_test.php
vendor/bin/phpunit local/kaltura/tests/migrationlib_test.php
Proposed Fix
Replace all instances of $this->assertObjectHasAttribute('name', $object) with $this->assertObjectHasProperty('name', $object).
Example:
// Before
$this->assertObjectHasAttribute('id', $result);
// After
$this->assertObjectHasProperty('id', $result);
The PHPUnit test suite is failing in the Moodle 5.1 environment because it calls
assertObjectHasAttribute(), which has been removed in PHPUnit 10.To maintain compatibility with Moodle 5.1 and newer PHPUnit versions, these calls must be updated to
assertObjectHasProperty().Error Logs
The following 4 errors were identified in:
Steps to Reproduce
Run the PHPUnit tests in a Moodle 5.1 environment:
Proposed Fix
Replace all instances of
$this->assertObjectHasAttribute('name', $object)with$this->assertObjectHasProperty('name', $object).Example: