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

testDownloadsAsString() public method

    public function testDownloadsAsString()
    {
        $key = base64_encode('abcd');
        $hash = base64_encode('1234');
        $bucket = 'bucket';
        $object = 'object.txt';
        $stream = Psr7\stream_for($string = 'abcdefg');
        $this->connection->downloadObject(['bucket' => $bucket, 'object' => $object, 'generation' => null, 'httpOptions' => ['headers' => ['x-goog-encryption-algorithm' => 'AES256', 'x-goog-encryption-key' => $key, 'x-goog-encryption-key-sha256' => $hash]]])->willReturn($stream)->shouldBeCalledTimes(1);
        $object = new StorageObject($this->connection->reveal(), $object, $bucket);
        $this->assertEquals($string, $object->downloadAsString(['encryptionKey' => $key, 'encryptionKeySHA256' => $hash]));
    }