Google\Cloud\Tests\Translate\TranslateClientTest::testDetectLanguage PHP Method

testDetectLanguage() public method

public testDetectLanguage ( )
    public function testDetectLanguage()
    {
        $expected = $this->getDetectionExpectedData('text', 'en', 0.5);
        $options = ['format' => 'text'];
        $this->connection->listDetections($options + ['q' => [$expected['input']], 'key' => $this->key])->willReturn(['data' => ['detections' => [$this->getDetectionApiData($expected['languageCode'], $expected['confidence'])]]])->shouldBeCalledTimes(1);
        $this->client->setConnection($this->connection->reveal());
        $detection = $this->client->detectLanguage($expected['input'], $options);
        $this->assertEquals($expected, $detection);
    }