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

testDetectLanguage() public method

public testDetectLanguage ( )
    public function testDetectLanguage()
    {
        $snippet = $this->snippetFromMethod(TranslateClient::class, 'detectLanguage');
        $snippet->addLocal('translate', $this->client);
        $this->connection->listDetections(Argument::any())->shouldBeCalled()->willReturn(['data' => ['detections' => [[['language' => 'en', 'confidence' => 1]]]]]);
        $this->client->setConnection($this->connection->reveal());
        $res = $snippet->invoke();
        $this->assertEquals('en', $res->output());
    }