Skip to content

Commit

Permalink
MDL-40039 phpunit: Test core_files_external::upload() without the new…
Browse files Browse the repository at this point in the history
… params
  • Loading branch information
ankitagarwal authored and danpoltawski committed Jul 4, 2013
1 parent 07dd7fc commit 71e38b1
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions files/tests/externallib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,27 @@ public function test_upload_param_area() {
$filename, $filecontent, $contextlevel, $instanceid);
}

/*
* Make sure core_files_external::upload() works without new parameters.
*/
public function test_upload_without_new_param() {
global $USER;

$this->resetAfterTest();
$this->setAdminUser();
$context = context_user::instance($USER->id);
$contextid = $context->id;
$component = "user";
$filearea = "private";
$itemid = 0;
$filepath = "/";
$filename = "Simple4.txt";
$filecontent = base64_encode("Let us create a nice simple file");

// Make sure the file is created.
@core_files_external::upload($contextid, $component, $filearea, $itemid, $filepath, $filename, $filecontent);
$browser = get_file_browser();
$file = $browser->get_file_info($context, $component, $filearea, $itemid, $filepath, $filename);
$this->assertNotEmpty($file);
}
}

0 comments on commit 71e38b1

Please sign in to comment.