Skip to content

Commit

Permalink
Replaced ServicesBuilder with QueueRestProxy
Browse files Browse the repository at this point in the history
  • Loading branch information
squigg committed Feb 7, 2018
1 parent 24f0c5d commit f6f1f03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/AzureConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Squigg\AzureQueueLaravel;

use Illuminate\Queue\Connectors\ConnectorInterface;
use MicrosoftAzure\Storage\Common\ServicesBuilder;
use MicrosoftAzure\Storage\Queue\QueueRestProxy;

class AzureConnector implements ConnectorInterface
{
Expand All @@ -18,7 +18,7 @@ class AzureConnector implements ConnectorInterface
public function connect(array $config)
{
$connectionString = 'DefaultEndpointsProtocol=' . $config['protocol'] . ';AccountName=' . $config['accountname'] . ';AccountKey=' . $config['key'];
$queueRestProxy = ServicesBuilder::getInstance()->createQueueService($connectionString);
$queueRestProxy = QueueRestProxy::createQueueService($connectionString);

return new AzureQueue($queueRestProxy, $config['queue'], $config['timeout']);
}
Expand Down
8 changes: 4 additions & 4 deletions tests/AzureConnectorTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

use MicrosoftAzure\Storage\Common\ServicesBuilder;
use MicrosoftAzure\Storage\Queue\Internal\IQueue;
use MicrosoftAzure\Storage\Queue\QueueRestProxy;
use Squigg\AzureQueueLaravel\AzureConnector;
use Squigg\AzureQueueLaravel\AzureQueue;

Expand All @@ -16,14 +16,14 @@ class AzureConnectorTest extends TestCase
/**
* @var \Mockery\Mock
*/
protected $servicesBuilder;
protected $queueRestProxy;

public function setUp()
{
parent::setUp();

$this->connector = new AzureConnector();
$this->servicesBuilder = Mockery::mock('alias:' . ServicesBuilder::class);
$this->queueRestProxy = Mockery::mock('alias:' . QueueRestProxy::class);
}

/** @test */
Expand All @@ -40,7 +40,7 @@ public function it_can_create_azure_queue()
$connectionString = 'DefaultEndpointsProtocol=' . $config['protocol'] . ';AccountName=' . $config['accountname'] . ';AccountKey=' . $config['key'];
$queueProxy = Mockery::mock(IQueue::class);

$this->servicesBuilder->shouldReceive('getInstance->createQueueService')->once()->with($connectionString)->andReturn($queueProxy);
$this->queueRestProxy->shouldReceive('createQueueService')->once()->with($connectionString)->andReturn($queueProxy);

/** @var AzureQueue $azureQueue */
$azureQueue = $this->connector->connect($config);
Expand Down

0 comments on commit f6f1f03

Please sign in to comment.