Google\Cloud\Tests\Snippets\Logging\LoggingClientTest::testEntriesWithFilter PHP 메소드

testEntriesWithFilter() 공개 메소드

    public function testEntriesWithFilter()
    {
        $snippet = $this->snippetFromMethod(LoggingClient::class, 'entries', 1);
        $snippet->addLocal('logging', $this->client);
        $this->connection->listEntries(Argument::that(function ($arg) {
            if (strpos($arg['filter'], 'logName') === false) {
                return false;
            }
            return true;
        }))->shouldBeCalled()->willReturn(['entries' => [['textPayload' => 'Entry 1'], ['textPayload' => 'Entry 2']]]);
        $this->client->setConnection($this->connection->reveal());
        $res = $snippet->invoke('entries');
        $this->assertInstanceOf(\Generator::class, $res->returnVal());
        $this->assertEquals('Entry 1', explode(PHP_EOL, $res->output())[0]);
        $this->assertEquals('Entry 2', explode(PHP_EOL, $res->output())[1]);
    }