/** * Test upload file */ public function testUploadFile() { // get path from config $path = 'uploads/musician'; if (empty($path)) { throw new Exception('Temporary path is not configured'); } $_FILES = array('file' => array('name' => 'test.jpg', 'size' => filesize($path), 'type' => 'image/jpeg', 'tmp_name' => $path, 'error' => 0)); Request::setFileUpload(new TestFileUpload()); $this->dispatchUri('media/crud', ['title' => 'test', 'file' => $_FILES['file']], 'POST'); $this->assertQueryCount('input[name="title"]', 1); $this->assertOk(); }