Google\Cloud\Tests\Snippets\Logging\LoggingClientTest::testMetrics PHP Method

testMetrics() public method

public testMetrics ( )
    public function testMetrics()
    {
        $snippet = $this->snippetFromMethod(LoggingClient::class, 'metrics');
        $snippet->addLocal('logging', $this->client);
        $this->connection->listMetrics(Argument::any())->shouldBeCalled()->willReturn(['metrics' => [['name' => 'Metric 1'], ['name' => 'Metric 2']]]);
        $this->client->setConnection($this->connection->reveal());
        $res = $snippet->invoke('metrics');
        $this->assertInstanceOf(\Generator::class, $res->returnVal());
        $this->assertEquals('Metric 1', explode(PHP_EOL, $res->output())[0]);
        $this->assertEquals('Metric 2', explode(PHP_EOL, $res->output())[1]);
    }