Google\Cloud\Tests\Snippets\Storage\StorageClientTest::testBucketsWithPrefix PHP Method

testBucketsWithPrefix() public method

    public function testBucketsWithPrefix()
    {
        $snippet = $this->snippetFromMethod(StorageClient::class, 'buckets', 1);
        $snippet->addLocal('storage', $this->client);
        $this->connection->listBuckets(Argument::any())->shouldBeCalled()->willReturn(['items' => [['name' => 'album 1'], ['name' => 'album 2']]]);
        $this->client->setConnection($this->connection->reveal());
        $res = $snippet->invoke('buckets');
        $this->assertInstanceOf(\Generator::class, $res->returnVal());
        $this->assertEquals('album 1', explode("\n", $res->output())[0]);
        $this->assertEquals('album 2', explode("\n", $res->output())[1]);
    }