Google\Cloud\Tests\Snippets\Storage\BucketTest::testObjects PHP Method

testObjects() public method

public testObjects ( )
    public function testObjects()
    {
        $snippet = $this->snippetFromMethod(Bucket::class, 'objects');
        $snippet->addLocal('bucket', $this->bucket);
        $this->connection->listObjects(Argument::any())->shouldBeCalled()->willReturn(['items' => [['name' => 'object 1'], ['name' => 'object 2']]]);
        $this->bucket->setConnection($this->connection->reveal());
        $res = $snippet->invoke('objects');
        $this->assertInstanceOf(\Generator::class, $res->returnVal());
        $this->assertEquals('object 1', explode("\n", $res->output())[0]);
        $this->assertEquals('object 2', explode("\n", $res->output())[1]);
    }