Skip to content
This repository has been archived by the owner on Jan 27, 2024. It is now read-only.

Make compatible with microsoft/azure-storage ~0.19.1 #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"require": {
"php": ">=5.5.0",
"league/flysystem": "~1.0",
"microsoft/azure-storage": "~0.10.1"
"microsoft/azure-storage": "~0.19.1"
},
"require-dev": {
"phpunit/phpunit": "~4.8.36",
Expand Down
2 changes: 1 addition & 1 deletion src/AzureAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions;
use MicrosoftAzure\Storage\Blob\Models\ListBlobsOptions;
use MicrosoftAzure\Storage\Blob\Models\ListBlobsResult;
use MicrosoftAzure\Storage\Common\ServiceException;
use MicrosoftAzure\Storage\Common\Exceptions\ServiceException;

class AzureAdapter extends AbstractAdapter
{
Expand Down
14 changes: 8 additions & 6 deletions tests/AzureTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

namespace League\Flysystem\Azure;

use GuzzleHttp\Psr7\Response;
use GuzzleHttp\Psr7\Stream;
use League\Flysystem\Config;
use Mockery;
use MicrosoftAzure\Storage\Blob\Models\CopyBlobResult;
use MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions;
use MicrosoftAzure\Storage\Blob\Models\GetBlobResult;
use MicrosoftAzure\Storage\Common\Internal\Resources;
use MicrosoftAzure\Storage\Common\ServiceException;
use MicrosoftAzure\Storage\Common\Exceptions\ServiceException;
use PHPUnit\Framework\TestCase;

class AzureTests extends TestCase
Expand All @@ -35,7 +37,7 @@ protected function getReadBlobResult($lastModified, $contentString)
return GetBlobResult::create([
Resources::LAST_MODIFIED => $lastModified,
Resources::CONTENT_LENGTH => strlen($contentString),
], $contentString, []);
], new Stream($this->getStreamFromString($contentString)), []);
}

protected function getStreamFromString($string)
Expand Down Expand Up @@ -187,17 +189,17 @@ public function testHasWhenFileExists()

public function testHasWhenFileDoesNotExist()
{
$this->azure->shouldReceive('getBlobMetadata')->andThrow(new ServiceException(404));
$this->azure->shouldReceive('getBlobMetadata')->andThrow(new ServiceException(new Response(404)));

$this->assertFalse($this->adapter->has('foo.txt'));
}

/**
* @expectedException MicrosoftAzure\Storage\Common\ServiceException
* @expectedException \MicrosoftAzure\Storage\Common\Exceptions\ServiceException
*/
public function testHasWhenError()
{
$this->azure->shouldReceive('getBlobMetadata')->andThrow(new ServiceException(500));
$this->azure->shouldReceive('getBlobMetadata')->andThrow(new ServiceException(new Response(500)));

$this->adapter->has('foo.txt');
}
Expand Down Expand Up @@ -367,7 +369,7 @@ public function testConfigShouldNotBeIgnored()
$settings = [
'ContentType' => 'someContentType',
'CacheControl' => 'someCacheControl',
'Metadata' => 'someMetadata',
'Metadata' => ['someMetadata'],
'ContentLanguage' => 'someContentLanguage',
'ContentEncoding' => 'someContentEncoding',
];
Expand Down