Google\Cloud\Tests\Speech\SpeechClientTest::audioProvider PHP Method

audioProvider() public method

public audioProvider ( )
    public function audioProvider()
    {
        stream_wrapper_unregister('http');
        stream_wrapper_register('http', HttpStreamWrapper::class);
        $amrMock = $this->prophesize(StorageObject::class);
        $amrMock->identity(Argument::any())->willReturn(['bucket' => 'bucket', 'object' => 'object.amr']);
        $awbMock = $this->prophesize(StorageObject::class);
        $awbMock->identity(Argument::any())->willReturn(['bucket' => 'bucket', 'object' => 'object.awb']);
        $audioPath = __DIR__ . '/../data/brooklyn.flac';
        return [[fopen($audioPath, 'r'), ['maxAlternatives' => 1, 'languageCode' => 'en-US', 'profanityFilter' => false, 'speechContext' => ['phrases' => ['Test']]], ['audio' => ['content' => base64_encode(file_get_contents($audioPath))], 'config' => ['encoding' => 'FLAC', 'sampleRate' => 16000, 'maxAlternatives' => 1, 'languageCode' => 'en-US', 'profanityFilter' => false, 'speechContext' => ['phrases' => ['Test']]]]], [file_get_contents($audioPath), ['encoding' => 'FLAC', 'sampleRate' => 16000], ['audio' => ['content' => base64_encode(file_get_contents($audioPath))], 'config' => ['encoding' => 'FLAC', 'sampleRate' => 16000]]], [file_get_contents($audioPath), [], ['audio' => ['content' => base64_encode(file_get_contents($audioPath))], 'config' => ['encoding' => 'FLAC', 'sampleRate' => 16000]]], [$amrMock->reveal(), [], ['audio' => ['uri' => 'gs://bucket/object.amr'], 'config' => ['encoding' => 'AMR', 'sampleRate' => 8000]]], [$awbMock->reveal(), [], ['audio' => ['uri' => 'gs://bucket/object.awb'], 'config' => ['encoding' => 'AMR_WB', 'sampleRate' => 16000]]], [fopen('http://www.example.com/file.flac', 'r'), ['sampleRate' => 16000], ['audio' => ['content' => base64_encode('abcd')], 'config' => ['encoding' => 'FLAC', 'sampleRate' => 16000]]]];
    }