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

testTranslate() public method

public testTranslate ( )
    public function testTranslate()
    {
        $expected = $this->getTranslateExpectedData('translate', 'translated', 'en');
        $options = ['source' => $expected['source'], 'target' => 'de', 'format' => 'text', 'model' => 'base'];
        $this->connection->listTranslations($options + ['q' => [$expected['input']], 'key' => $this->key])->willReturn(['data' => ['translations' => [$this->getTranslateApiData($expected['text'])]]])->shouldBeCalledTimes(1);
        $this->client->setConnection($this->connection->reveal());
        $translation = $this->client->translate($expected['input'], $options);
        $this->assertEquals($expected, $translation);
    }