MDL-52284 core: compatibility with Exception/Throwable changes in PHP7

This commit is contained in:
Tony Levi 2015-08-03 16:16:03 +09:30 committed by Marina Glancy
parent 0dfcc2541a
commit d74b7e424f
7 changed files with 43 additions and 8 deletions

View file

@ -126,6 +126,8 @@ class backp_settings_testcase extends basic_testcase {
} catch (exception $e) {
$this->assertTrue($e instanceof base_setting_exception);
$this->assertEquals($e->errorcode, 'incorrect_object_passed');
} catch (TypeError $e) {
// PHP7 will catch type errors for us.
}
restore_error_handler();
@ -140,6 +142,8 @@ class backp_settings_testcase extends basic_testcase {
} catch (exception $e) {
$this->assertTrue($e instanceof base_setting_exception);
$this->assertEquals($e->errorcode, 'incorrect_object_passed');
} catch (TypeError $e) {
// PHP7 will catch type errors for us.
}
restore_error_handler();
@ -302,6 +306,8 @@ class backp_settings_testcase extends basic_testcase {
} catch (exception $e) {
$this->assertTrue($e instanceof backup_setting_exception);
$this->assertEquals($e->errorcode, 'incorrect_object_passed');
} catch (TypeError $e) {
// PHP7 will catch type errors for us.
}
restore_error_handler();