diff --git a/lib/tests/filelib_test.php b/lib/tests/filelib_test.php index 4b5c20a260b..aa07dc58b64 100644 --- a/lib/tests/filelib_test.php +++ b/lib/tests/filelib_test.php @@ -471,6 +471,29 @@ class core_filelib_testcase extends advanced_testcase { $this->assertSame('OK', $contents); } + public function test_curl_file() { + $this->resetAfterTest(); + $testurl = $this->getExternalTestFileUrl('/test_file.php'); + + $fs = get_file_storage(); + $filerecord = array( + 'contextid' => context_system::instance()->id, + 'component' => 'test', + 'filearea' => 'curl_post', + 'itemid' => 0, + 'filepath' => '/', + 'filename' => 'test.txt' + ); + $teststring = 'moodletest'; + $testfile = $fs->create_file_from_string($filerecord, $teststring); + + // Test post with file. + $data = array('testfile' => $testfile); + $curl = new curl(); + $contents = $curl->post($testurl, $data); + $this->assertSame('OK', $contents); + } + /** * Testing prepare draft area *