Google\Cloud\Tests\Snippets\Translate\TranslateClientTest::testTranslate PHP Метод

testTranslate() публичный Метод

public testTranslate ( )
    public function testTranslate()
    {
        $snippet = $this->snippetFromMethod(TranslateClient::class, 'translate');
        $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());
    }