Google\Cloud\Tests\Snippets\Translate\TranslateClientTest::testTranslateBatch PHP Method

testTranslateBatch() public method

public testTranslateBatch ( )
    public function testTranslateBatch()
    {
        $snippet = $this->snippetFromMethod(TranslateClient::class, 'translateBatch');
        $snippet->addLocal('translate', $this->client);
        $this->connection->listTranslations(Argument::any())->shouldBeCalled()->willReturn(['data' => ['translations' => [['detectedSourceLanguage' => 'en', 'translatedText' => 'foobar']]]]);
        $this->client->setConnection($this->connection->reveal());
        $res = $snippet->invoke();
        $this->assertEquals('foobar', $res->output());
    }