Skip to content

Commit 7ea9f0e

Browse files
committed
add condition to use deprecated function in older Moodle versions
1 parent 9605eba commit 7ea9f0e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/review_test.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,15 @@ private function run_send_mails() {
257257
* @param object|array $actual
258258
*/
259259
private function assert_matches_properties($expected, $actual) {
260+
global $CFG;
260261
$expected = (array)$expected;
261262
$actual = (object)$actual;
262263
foreach ($expected as $key => $value) {
263-
$this->assertObjectHasProperty($key, $actual, "Failed asserting that attribute '$key' exists.");
264+
if ($CFG->branch >= 404) {
265+
$this->assertObjectHasProperty($key, $actual, "Failed asserting that attribute '$key' exists.");
266+
} else {
267+
$this->assertObjectHasAttribute($key, $actual, "Failed asserting that attribute '$key' exists.");
268+
}
264269
$this->assertEquals($value, $actual->$key, "Failed asserting that \$obj->$key '" . $actual->$key . "' equals '$value'");
265270
}
266271
}

0 commit comments

Comments
 (0)