diff --git a/doc/drivers.rst b/doc/drivers.rst index 23e15a77..766b94fb 100644 --- a/doc/drivers.rst +++ b/doc/drivers.rst @@ -459,7 +459,7 @@ require a HTTP request to amazon to be resolved. 'your-aws-access-key', @@ -467,13 +467,13 @@ require a HTTP request to amazon to be resolved. 'region' => 'the-aws-region-you-choose' )); - $driver = new SqsDriver($connection); + $driver = new Driver($connection); // or with prefetching - $driver = new SqsDriver($connection, array(), 5); + $driver = new Driver($connection, array(), 5); // or with aliased queue urls - $driver = new SqsDriver($connection, array( + $driver = new Driver($connection, array( 'queue-name' => 'queue-url', )); diff --git a/example/sqs.php b/example/sqs.php index 1e1ae06a..3f31d2d4 100644 --- a/example/sqs.php +++ b/example/sqs.php @@ -1,7 +1,7 @@ getenv('SQS_REGION') )); - return new SqsDriver($sqs); + return new Driver($sqs); } if (!getenv('ACCESS_KEY') || !getenv('SECRET_KEY') || !getenv('SQS_REGION')) { diff --git a/src/Driver/SqsDriver.php b/src/Driver/Sqs/Driver.php similarity index 96% rename from src/Driver/SqsDriver.php rename to src/Driver/Sqs/Driver.php index 973dc9d5..35e11023 100644 --- a/src/Driver/SqsDriver.php +++ b/src/Driver/Sqs/Driver.php @@ -1,9 +1,10 @@ queueUrls[$queueName])) { return $this->queueUrls[$queueName]; diff --git a/tests/Driver/SqsDriverTest.php b/tests/Driver/Sqs/DriverTest.php similarity index 93% rename from tests/Driver/SqsDriverTest.php rename to tests/Driver/Sqs/DriverTest.php index 29b665a8..0b68feba 100644 --- a/tests/Driver/SqsDriverTest.php +++ b/tests/Driver/Sqs/DriverTest.php @@ -1,21 +1,28 @@ sqs = $this->getMockBuilder('Aws\Sqs\SqsClient') + $this->sqs = $this->getMockBuilder(SqsClient::class) ->disableOriginalConstructor() ->setMethods(array( 'createQueue', @@ -29,12 +36,12 @@ public function setUp() )) ->getMock(); - $this->driver = new SqsDriver($this->sqs, ['send-newsletter' => 'url']); + $this->driver = new Driver($this->sqs, ['send-newsletter' => 'url']); } public function testItExposesInfo() { - $driver = new SqsDriver($this->sqs, [], 10); + $driver = new Driver($this->sqs, [], 10); $this->assertEquals(['prefetch' => 10], $driver->info()); $this->assertEquals(['prefetch' => 2], $this->driver->info()); @@ -42,7 +49,7 @@ public function testItExposesInfo() public function testItImplementsDriverInterface() { - $this->assertInstanceOf('Bernard\Driver\AbstractPrefetchDriver', $this->driver); + $this->assertInstanceOf(AbstractPrefetchDriver::class, $this->driver); } public function testItCreatesQueue() @@ -127,7 +134,7 @@ public function testUnresolveableQueueNameThrowsException() public function testItGetsAllQueues() { - $driver = new SqsDriver($this->sqs, [ + $driver = new Driver($this->sqs, [ 'import-users' => 'alreadyknowurl/import_users_prod' ]); @@ -195,7 +202,7 @@ public function testItPushesMessagesToFifoQueue() ->with($this->equalTo([ 'QueueUrl' => self::DUMMY_QUEUE_URL_PREFIX. '/'. self::DUMMY_FIFO_QUEUE_NAME, 'MessageBody' => $message, - 'MessageGroupId' => \Bernard\Driver\SqsDriver::class . '::pushMessage', + 'MessageGroupId' => \Bernard\Driver\Sqs\Driver::class . '::pushMessage', 'MessageDeduplicationId' => md5($message), ]));