function testUploadAudio_WavFile_uploadDisallowed() { $project = self::$environ->createProject(SF_TESTPROJECT, SF_TESTPROJECTCODE); $projectId = $project->write(); $text = new TextModel($project); $textId = $text->write(); $tmpFilePath = self::$environ->uploadTextAudioFile(TestPhpPath . 'common/TestAudio.wav', 'TestAudio.mp3', $textId); $response = SfchecksUploadCommands::uploadFile($projectId, 'audio', $tmpFilePath); $this->assertFalse($response->result, 'Import should fail'); $this->assertEquals('UserMessage', $response->data->errorType, 'Error response should be a user message'); $this->assertRegExp('/Ensure the file is a .mp3/', $response->data->errorMessage, 'Error message should match the error'); $tmpFilePath = self::$environ->uploadTextAudioFile(TestPhpPath . 'common/TestAudio.mp3', 'TestAudio.wav', $textId); $response = SfchecksUploadCommands::uploadFile($projectId, 'audio', $tmpFilePath); $this->assertFalse($response->result, 'Import should fail'); $this->assertEquals('UserMessage', $response->data->errorType, 'Error response should be a user message'); $this->assertRegExp('/Ensure the file is a .mp3/', $response->data->errorMessage, 'Error message should match the error'); self::$environ->cleanupTestFiles($project->getAssetsFolderPath()); }
public function sfChecks_uploadFile($mediaType, $tmpFilePath) { $response = SfchecksUploadCommands::uploadFile($this->projectId, $mediaType, $tmpFilePath); return JsonEncoder::encode($response); }