Google\Cloud\Tests\Storage\StorageObjectTest::testCopyObjectWithDefaultName PHP Method

testCopyObjectWithDefaultName() public method

    public function testCopyObjectWithDefaultName()
    {
        $sourceBucket = 'bucket';
        $destinationBucket = 'bucket2';
        $objectName = 'object.txt';
        $acl = 'private';
        $key = base64_encode('abcd');
        $hash = base64_encode('1234');
        $this->connection->copyObject(['sourceBucket' => $sourceBucket, 'sourceObject' => $objectName, 'destinationBucket' => $destinationBucket, 'destinationObject' => $objectName, 'destinationPredefinedAcl' => $acl, 'httpOptions' => ['headers' => ['x-goog-encryption-algorithm' => 'AES256', 'x-goog-encryption-key' => $key, 'x-goog-encryption-key-sha256' => $hash]]])->willReturn(['bucket' => $destinationBucket, 'name' => $objectName, 'generation' => 1])->shouldBeCalledTimes(1);
        $object = new StorageObject($this->connection->reveal(), $objectName, $sourceBucket);
        $copiedObject = $object->copy($destinationBucket, ['predefinedAcl' => $acl, 'encryptionKey' => $key, 'encryptionKeySHA256' => $hash]);
        $this->assertEquals($destinationBucket, $copiedObject->info()['bucket']);
        $this->assertEquals($objectName, $copiedObject->info()['name']);
    }