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

testGetResumableUploader() public method

    public function testGetResumableUploader()
    {
        $snippet = $this->snippetFromMethod(Bucket::class, 'getResumableUploader');
        $snippet->addLocal('bucket', $this->bucket);
        $snippet->addUse(GoogleException::class);
        $snippet->replace("__DIR__ . '/image.jpg'", '"php://temp"');
        $uploader = $this->prophesize(ResumableUploader::class);
        $uploader->upload()->shouldBeCalledTimes(1)->willThrow(new GoogleException('test'));
        $uri = 'http://test.com/path';
        $uploader->resume($uri)->shouldBeCalled()->willReturn(['name' => 'Foo', 'generation' => 'Bar']);
        $uploader->getResumeUri()->shouldBeCalled()->willReturn($uri);
        $this->connection->insertObject(Argument::any())->shouldBeCalled()->willReturn($uploader->reveal());
        $this->bucket->setConnection($this->connection->reveal());
        $res = $snippet->invoke('object');
    }