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

testRecognize() public method

public testRecognize ( $audio, array $options, array $expectedOptions )
$options array
$expectedOptions array
    public function testRecognize($audio, array $options, array $expectedOptions)
    {
        $transcript = 'testing';
        $confidence = 1.0;
        $this->connection->syncRecognize($expectedOptions)->willReturn(['results' => [['alternatives' => [['transcript' => $transcript, 'confidence' => $confidence]]]]])->shouldBeCalledTimes(1);
        $this->client->setConnection($this->connection->reveal());
        $results = $this->client->recognize($audio, $options);
        $this->assertEquals($transcript, $results[0]['transcript']);
        $this->assertEquals($confidence, $results[0]['confidence']);
    }