public function lex_upload_importLift($mediaType, $tmpFilePath) { $response = LexUploadCommands::importLiftFile($this->projectId, $mediaType, $tmpFilePath); return JsonEncoder::encode($response); }
public function testImportLift_JpgFile_UploadDisallowed() { $project = $this->environ->createProject(SF_TESTPROJECT, SF_TESTPROJECTCODE); $projectId = $project->id->asString(); $tmpFilePath = $this->environ->uploadLiftFile(self::liftOneEntryV0_13, 'OneEntryV0_13.jpg', LiftMergeRule::IMPORT_LOSES); $response = LexUploadCommands::importLiftFile($projectId, 'import-lift', $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 LIFT file/', $response->data->errorMessage, 'Error message should match the error'); $tmpFilePath = $this->environ->uploadFile(TestPath . 'common/TestImage.jpg', 'TestImage.lift'); $response = LexUploadCommands::importLiftFile($projectId, 'import-lift', $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 LIFT file/', $response->data->errorMessage, 'Error message should match the error'); }