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

testDetectLanguageBatch() public method

    public function testDetectLanguageBatch()
    {
        $expected1 = $this->getDetectionExpectedData('text', 'en', 0.5);
        $expected2 = $this->getDetectionExpectedData('text2', 'en', 0.7);
        $stringsToDetect = [$expected1['input'], $expected2['input']];
        $this->connection->listDetections(['q' => $stringsToDetect, 'key' => $this->key])->willReturn(['data' => ['detections' => [$this->getDetectionApiData($expected1['languageCode'], $expected1['confidence']), $this->getDetectionApiData($expected2['languageCode'], $expected2['confidence'])]]])->shouldBeCalledTimes(1);
        $this->client->setConnection($this->connection->reveal());
        $detections = $this->client->detectLanguageBatch($stringsToDetect);
        $this->assertEquals($expected1, $detections[0]);
        $this->assertEquals($expected2, $detections[1]);
    }