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

testBuckets() public method

public testBuckets ( )
    public function testBuckets()
    {
        $snippet = $this->snippetFromMethod(StorageClient::class, 'buckets');
        $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());
        $buckets = iterator_to_array($res->returnVal());
        $this->assertEquals('album 1', $buckets[0]->name());
        $this->assertEquals('album 2', $buckets[1]->name());
    }