public function testDeleteImageFile_JpgFile_FileDeleted()
 {
     $project = $this->environ->createProject(SF_TESTPROJECT, SF_TESTPROJECTCODE);
     $projectId = $project->id->asString();
     $fileName = 'TestImage.jpg';
     $tmpFilePath = $this->environ->uploadFile(TestPath . "common/{$fileName}", $fileName);
     $response = LexUploadCommands::uploadImageFile($projectId, 'sense-image', $tmpFilePath);
     $this->assertTrue($response->result, 'Import should succeed');
     $folderPath = LexUploadCommands::imageFolderPath($project->getAssetsFolderPath());
     $fileName = $response->data->fileName;
     $filePath = $folderPath . '/' . $fileName;
     $this->assertTrue(file_exists($filePath), 'Imported LIFT file should exist');
     $response = LexUploadCommands::deleteMediaFile($projectId, 'sense-image', $fileName);
     $this->assertTrue($response->result, 'Import should succeed');
     $this->assertFalse(file_exists($filePath), 'Imported LIFT file should be deleted');
 }
 public function lex_uploadImageFile($mediaType, $tmpFilePath)
 {
     $response = LexUploadCommands::uploadImageFile($this->projectId, $mediaType, $tmpFilePath);
     return JsonEncoder::encode($response);
 }
 $response = LexUploadCommands::uploadAudioFile($testProjectId, 'audio', $tmpFilePath);
 // cleanup tmp file if it still exists
 if (file_exists($tmpFilePath) and !is_dir($tmpFilePath)) {
     @unlink($tmpFilePath);
 }
 // put uploaded file into entry1
 $constants['testEntry1']['lexeme']['th-Zxxx-x-audio']['value'] = $response->data->fileName;
 // setup to mimic file upload
 $fileName = $constants['testEntry1']['senses'][0]['pictures'][0]['fileName'];
 $file = array();
 $file['name'] = $fileName;
 $_FILES['file'] = $file;
 // put a copy of the test file in tmp
 $tmpFilePath = sys_get_temp_dir() . "/CopyOf{$fileName}";
 copy(TestPath . "php/common/{$fileName}", $tmpFilePath);
 $response = LexUploadCommands::uploadImageFile($testProjectId, 'sense-image', $tmpFilePath);
 // cleanup tmp file if it still exists
 if (file_exists($tmpFilePath) and !is_dir($tmpFilePath)) {
     @unlink($tmpFilePath);
 }
 // put uploaded file into entry1
 $constants['testEntry1']['senses'][0]['pictures'][0]['fileName'] = $response->data->fileName;
 $entry1 = LexEntryCommands::updateEntry($testProjectId, array('id' => '', 'lexeme' => $constants['testEntry1']['lexeme'], 'senses' => $constants['testEntry1']['senses']), $managerUserId);
 $entry2 = LexEntryCommands::updateEntry($testProjectId, array('id' => '', 'lexeme' => $constants['testEntry2']['lexeme'], 'senses' => $constants['testEntry2']['senses']), $managerUserId);
 $multipleMeaningEntry1 = LexEntryCommands::updateEntry($testProjectId, array('id' => '', 'lexeme' => $constants['testMultipleMeaningEntry1']['lexeme'], 'senses' => $constants['testMultipleMeaningEntry1']['senses']), $managerUserId);
 // put mock uploaded zip import (jpg file)
 $fileName = $constants['testMockJpgImportFile']['name'];
 $tmpFilePath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $fileName;
 copy(TestPath . "php/common/{$fileName}", $tmpFilePath);
 // put mock uploaded zip import (zip file)
 $fileName = $constants['testMockZipImportFile']['name'];