Merge branch 'wip-MDL-55827-master' of git://github.com/marinaglancy/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2016-09-20 01:02:06 +02:00
commit 8dcc999d96
3 changed files with 29 additions and 1 deletions

View File

@ -145,7 +145,8 @@ class core_files_externallib_testcase extends advanced_testcase {
$instanceid = null;
// Make sure the file is created.
$fileinfo = @core_files_external::upload($contextid, $component, $filearea, $itemid, $filepath, $filename, $filecontent);
$fileinfo = core_files_external::upload($contextid, $component, $filearea, $itemid, $filepath, $filename, $filecontent,
'user', $USER->id);
$fileinfo = external_api::clean_returnvalue(core_files_external::upload_returns(), $fileinfo);
$browser = get_file_browser();
$file = $browser->get_file_info($context, $component, $filearea, $itemid, $filepath, $filename);

View File

@ -4177,6 +4177,9 @@ class core_dml_testcase extends database_driver_testcase {
$this->fail("Expecting an exception, none occurred");
} catch (moodle_exception $e) {
$this->assertInstanceOf('coding_exception', $e);
} catch (Error $error) {
// PHP 7.1 throws Error even earlier.
$this->assertRegExp('/Too few arguments to function/', $error->getMessage());
}
// Cover the function using placeholders in all positions.

View File

@ -202,12 +202,18 @@ class core_moodlelib_testcase extends advanced_testcase {
$this->fail('coding_exception expected');
} catch (moodle_exception $ex) {
$this->assertInstanceOf('coding_exception', $ex);
} catch (Error $error) {
// PHP 7.1 throws Error even earlier.
$this->assertRegExp('/Too few arguments to function/', $error->getMessage());
}
try {
@optional_param('username');
$this->fail('coding_exception expected');
} catch (moodle_exception $ex) {
$this->assertInstanceOf('coding_exception', $ex);
} catch (Error $error) {
// PHP 7.1 throws Error even earlier.
$this->assertRegExp('/Too few arguments to function/', $error->getMessage());
}
try {
optional_param('', 'default_user', PARAM_RAW);
@ -248,12 +254,18 @@ class core_moodlelib_testcase extends advanced_testcase {
$this->fail('coding_exception expected');
} catch (moodle_exception $ex) {
$this->assertInstanceOf('coding_exception', $ex);
} catch (Error $error) {
// PHP 7.1 throws Error even earlier.
$this->assertRegExp('/Too few arguments to function/', $error->getMessage());
}
try {
@optional_param_array('username');
$this->fail('coding_exception expected');
} catch (moodle_exception $ex) {
$this->assertInstanceOf('coding_exception', $ex);
} catch (Error $error) {
// PHP 7.1 throws Error even earlier.
$this->assertRegExp('/Too few arguments to function/', $error->getMessage());
}
try {
optional_param_array('', array('a'=>'default_user'), PARAM_RAW);
@ -305,6 +317,9 @@ class core_moodlelib_testcase extends advanced_testcase {
$this->fail('coding_exception expected');
} catch (moodle_exception $ex) {
$this->assertInstanceOf('coding_exception', $ex);
} catch (Error $error) {
// PHP 7.1 throws Error even earlier.
$this->assertRegExp('/Too few arguments to function/', $error->getMessage());
}
try {
required_param('username', '');
@ -348,6 +363,9 @@ class core_moodlelib_testcase extends advanced_testcase {
$this->fail('coding_exception expected');
} catch (moodle_exception $ex) {
$this->assertInstanceOf('coding_exception', $ex);
} catch (Error $error) {
// PHP 7.1 throws Error.
$this->assertRegExp('/Too few arguments to function/', $error->getMessage());
}
try {
required_param_array('', PARAM_RAW);
@ -409,6 +427,9 @@ class core_moodlelib_testcase extends advanced_testcase {
$this->fail('moodle_exception expected');
} catch (moodle_exception $ex) {
$this->assertInstanceOf('moodle_exception', $ex);
} catch (Error $error) {
// PHP 7.1 throws Error even earlier.
$this->assertRegExp('/Too few arguments to function/', $error->getMessage());
}
}
@ -429,6 +450,9 @@ class core_moodlelib_testcase extends advanced_testcase {
$this->fail('moodle_exception expected');
} catch (moodle_exception $ex) {
$this->assertInstanceOf('moodle_exception', $ex);
} catch (Error $error) {
// PHP 7.1 throws Error even earlier.
$this->assertRegExp('/Too few arguments to function/', $error->getMessage());
}
try {