public function lex_upload_importProjectZip($mediaType, $tmpFilePath) { $response = LexUploadCommands::importProjectZip($this->projectId, $mediaType, $tmpFilePath); return JsonEncoder::encode($response); }
public function testImportProjectZip_JpgFile_UploadDisallowed() { $project = $this->environ->createProject(SF_TESTPROJECT, SF_TESTPROJECTCODE); $projectId = $project->id->asString(); $tmpFilePath = $this->environ->uploadFile(TestPath . 'common/TestImage.jpg', 'TestLexProject.zip'); $response = LexUploadCommands::importProjectZip($projectId, 'import-zip', $tmpFilePath); $this->assertFalse($response->result, 'Import should fail'); $this->assertEqual('UserMessage', $response->data->errorType, 'Error response should be a user message'); $this->assertPattern('/not an allowed compressed file/', $response->data->errorMessage, 'Error message should match the error'); $tmpFilePath = $this->environ->uploadFile(TestPath . 'common/TestLexProject.zip', 'TestImage.jpg'); $response = LexUploadCommands::importProjectZip($projectId, 'import-zip', $tmpFilePath); $this->assertFalse($response->result, 'Import should fail'); $this->assertEqual('UserMessage', $response->data->errorType, 'Error response should be a user message'); $this->assertPattern('/not an allowed compressed file/', $response->data->errorMessage, 'Error message should match the error'); }