MDL-78019 core: Whitespace fixes

This commit is contained in:
Andrew Nicols 2023-06-01 10:20:06 +08:00
parent e60843f355
commit 8d1a2c960a
No known key found for this signature in database
GPG Key ID: 6D1E3157C8CFBF14
2 changed files with 27 additions and 27 deletions

View File

@ -48,28 +48,28 @@ class draft_file_deleted_test extends \advanced_testcase {
$fs = get_file_storage();
$filerecord = [
'contextid' => $usercontext->id,
'component' => 'core',
'filearea' => 'unittest',
'itemid' => 0,
'filepath' => '/',
'filename' => 'test.txt',
'source' => 'Copyright stuff',
'contextid' => $usercontext->id,
'component' => 'core',
'filearea' => 'unittest',
'itemid' => 0,
'filepath' => '/',
'filename' => 'test.txt',
'source' => 'Copyright stuff',
];
$originalfile = $fs->create_file_from_string($filerecord, 'Test content');
$nbsp = "\xc2\xa0";
// Event data for logging.
$eventdata = [
'objectid' => $originalfile->get_id(),
'context' => $usercontext,
'other' => [
'itemid' => $originalfile->get_itemid(),
'filename' => $originalfile->get_filename(),
'filesize' => $originalfile->get_filesize(),
'filepath' => $originalfile->get_filepath(),
'contenthash' => $originalfile->get_contenthash(),
]
'objectid' => $originalfile->get_id(),
'context' => $usercontext,
'other' => [
'itemid' => $originalfile->get_itemid(),
'filename' => $originalfile->get_filename(),
'filesize' => $originalfile->get_filesize(),
'filepath' => $originalfile->get_filepath(),
'contenthash' => $originalfile->get_contenthash(),
],
];
$event = \core\event\draft_file_deleted::create($eventdata);
$event->trigger();
@ -79,7 +79,7 @@ class draft_file_deleted_test extends \advanced_testcase {
$event = reset($events);
$this->assertEquals($usercontext, $event->get_context());
$expected = "The user with id '{$user->id}' has deleted file '/test.txt' from the draft file area with item id 0. ".
$expected = "The user with id '{$user->id}' has deleted file '/test.txt' from the draft file area with item id 0. " .
"Size: 12{$nbsp}bytes. Content hash: {$originalfile->get_contenthash()}.";
$this->assertSame($expected, $event->get_description());
}

View File

@ -3269,17 +3269,17 @@ function repository_delete_selected_files($context, string $component, string $f
* @param context $context The context where delete is called.
* @param stored_file $storedfile the file to be logged.
*/
function create_event_draft_file_deleted(context $context, stored_file $storedfile) :void {
function create_event_draft_file_deleted(context $context, stored_file $storedfile): void {
$logevent = \core\event\draft_file_deleted::create([
'objectid' => $storedfile->get_id(),
'context' => $context,
'other' => [
'itemid' => $storedfile->get_itemid(),
'filename' => $storedfile->get_filename(),
'filesize' => $storedfile->get_filesize(),
'filepath' => $storedfile->get_filepath(),
'contenthash' => $storedfile->get_contenthash(),
],
'objectid' => $storedfile->get_id(),
'context' => $context,
'other' => [
'itemid' => $storedfile->get_itemid(),
'filename' => $storedfile->get_filename(),
'filesize' => $storedfile->get_filesize(),
'filepath' => $storedfile->get_filepath(),
'contenthash' => $storedfile->get_contenthash(),
],
]);
$logevent->trigger();
}