From fb758ce2a9a3ac9f4aa18669bcab6795fb9e2895 Mon Sep 17 00:00:00 2001 From: squigg Date: Sat, 26 Jul 2025 00:00:02 +1200 Subject: [PATCH 1/2] Add 12.x to README --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2403631..5016b34 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ PHP Laravel Queue Driver package to support Microsoft Azure Storage Queues - PHP 8.0+ for Laravel 9+ - PHP 8.1+ for Laravel 10+ - PHP 8.1+ for Laravel 11+ +- PHP 8.2+ for Laravel 12+ - Microsoft Azure Storage Account and Storage Account Key - Queue container created through Azure Portal or via [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/storage/queue?view=azure-cli-latest#az-storage-queue-create) @@ -32,6 +33,9 @@ You can find this library on [Packagist](https://packagist.org/packages/squigg/a Require this package in your `composer.json`. The version numbers will follow Laravel. +#### Laravel 12.x + "squigg/azure-queue-laravel": "^12.0" + composer require squigg/azure-queue-laravel:^12.0 #### Laravel 11.x "squigg/azure-queue-laravel": "^11.0" composer require squigg/azure-queue-laravel:^11.0 @@ -136,7 +140,9 @@ Remember to update the default queue by setting the `QUEUE_DRIVER` value in your ## Changelog -2023-03-30 - V11.0 - Support for Laravel 11.x +2025-07-25 - V11.0 - Support for Laravel 12.x + +2024-03-30 - V11.0 - Support for Laravel 11.x 2023-03-17 - V10.0 - Support for Laravel 10.x From 7cdb02c11083dd8795d42a59a100cc3bf76c9c78 Mon Sep 17 00:00:00 2001 From: squigg Date: Sat, 26 Jul 2025 00:24:40 +1200 Subject: [PATCH 2/2] Update tests to avoid phpunit deprecations and warnings --- phpunit.xml | 35 +++++++++++++------------ tests/AzureConnectorTest.php | 7 ++--- tests/AzureJobTest.php | 18 ++++++------- tests/AzureQueueServiceProviderTest.php | 3 ++- tests/AzureQueueTest.php | 21 ++++++++------- tests/TestCase.php | 2 ++ 6 files changed, 46 insertions(+), 40 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 524cc81..cba776e 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,19 +1,20 @@ - - - - - src/ - - - - - - - - - - tests - - + + + + src + + + + + + + + + + + tests + + diff --git a/tests/AzureConnectorTest.php b/tests/AzureConnectorTest.php index 9e172b2..a9729c7 100644 --- a/tests/AzureConnectorTest.php +++ b/tests/AzureConnectorTest.php @@ -5,6 +5,7 @@ use MicrosoftAzure\Storage\Queue\QueueRestProxy; use Mockery; use Mockery\MockInterface; +use PHPUnit\Framework\Attributes\Test; use Squigg\AzureQueueLaravel\AzureConnector; use Squigg\AzureQueueLaravel\AzureQueue; @@ -31,7 +32,7 @@ protected function setUp(): void $this->queueRestProxy = Mockery::mock('alias:' . QueueRestProxy::class); } - /** @test */ + #[Test] public function it_can_create_azure_queue() { $connectionString = 'DefaultEndpointsProtocol=https;AccountName=foo;AccountKey=bar'; @@ -44,7 +45,7 @@ public function it_can_create_azure_queue() $this->assertEquals(25, $azureQueue->getVisibilityTimeout()); } - /** @test */ + #[Test] public function it_can_create_azure_queue_with_endpoint() { $this->config['endpoint'] = 'mysuffix'; @@ -57,7 +58,7 @@ public function it_can_create_azure_queue_with_endpoint() $this->connector->connect($this->config); } - /** @test */ + #[Test] public function it_can_create_azure_queue_with_queue_endpoint() { $this->config['queue_endpoint'] = 'http://localhost:10001/test'; diff --git a/tests/AzureJobTest.php b/tests/AzureJobTest.php index f6d1174..010fa95 100644 --- a/tests/AzureJobTest.php +++ b/tests/AzureJobTest.php @@ -4,8 +4,8 @@ use MicrosoftAzure\Storage\Queue\Internal\IQueue; use MicrosoftAzure\Storage\Queue\Models\QueueMessage; use Mockery; -use Mockery\Mock; use Mockery\MockInterface; +use PHPUnit\Framework\Attributes\Test; use Squigg\AzureQueueLaravel\AzureJob; use Squigg\AzureQueueLaravel\AzureQueue; @@ -34,51 +34,51 @@ protected function setUp(): void $this->job = new AzureJob($this->app, $this->azure, $this->message, 'myconnection', 'myqueue'); } - /** @test */ + #[Test] public function it_can_get_job_id() { $this->assertEquals('1234', $this->job->getJobId()); } - /** @test */ + #[Test] public function it_can_delete_job_from_queue() { $this->azure->shouldReceive('deleteMessage')->once()->withArgs(['myqueue', '1234', '9876']); $this->job->delete(); } - /** @test */ + #[Test] public function it_can_release_job_back_to_queue() { $this->azure->shouldReceive('updateMessage')->once()->withArgs(['myqueue', '1234', '9876', null, 10]); $this->job->release(10); } - /** @test */ + #[Test] public function it_can_get_azure_job() { $this->assertEquals($this->message, $this->job->getAzureJob()); } - /** @test */ + #[Test] public function it_can_get_raw_body() { $this->assertEquals('{"abcd":"efgh"}', $this->job->getRawBody()); } - /** @test */ + #[Test] public function it_can_get_azure_proxy() { $this->assertInstanceOf(IQueue::class, $this->job->getAzure()); } - /** @test */ + #[Test] public function it_can_get_number_of_attempts() { $this->assertEquals(2, $this->job->attempts()); } - /** @test */ + #[Test] public function it_can_get_app_container() { $this->assertEquals($this->app, $this->job->getContainer()); diff --git a/tests/AzureQueueServiceProviderTest.php b/tests/AzureQueueServiceProviderTest.php index ec1c465..4d71f4e 100644 --- a/tests/AzureQueueServiceProviderTest.php +++ b/tests/AzureQueueServiceProviderTest.php @@ -4,13 +4,14 @@ use Illuminate\Foundation\Application; use Illuminate\Queue\QueueManager; use Mockery; +use PHPUnit\Framework\Attributes\Test; use Squigg\AzureQueueLaravel\AzureConnector; use Squigg\AzureQueueLaravel\AzureQueueServiceProvider; class AzureQueueServiceProviderTest extends TestCase { - /** @test */ + #[Test] public function it_can_boot_and_setup_queue_manager() { $mockApp = Mockery::mock(Application::class); diff --git a/tests/AzureQueueTest.php b/tests/AzureQueueTest.php index 038c51a..14b3475 100644 --- a/tests/AzureQueueTest.php +++ b/tests/AzureQueueTest.php @@ -8,6 +8,7 @@ use Mockery; use Mockery\ExpectationInterface; use Mockery\MockInterface; +use PHPUnit\Framework\Attributes\Test; use Squigg\AzureQueueLaravel\AzureJob; use Squigg\AzureQueueLaravel\AzureQueue; use Squigg\AzureQueueLaravel\Tests\Fixtures\ListMessagesResult; @@ -32,7 +33,7 @@ protected function setListMessagesReturnExpectation(ExpectationInterface $mock, return $mock->andReturn(new ListMessagesResult($count)); } - /** @test */ + #[Test] public function it_can_push_message_to_queue() { $this->azure->shouldReceive('createMessage')->once()->withArgs(function ($queue, $payload) { @@ -42,7 +43,7 @@ public function it_can_push_message_to_queue() $this->queue->push('foojob', 'bardata'); } - /** @test */ + #[Test] public function it_can_pop_message_from_queue() { $this->setListMessagesReturnExpectation($this->azure->shouldReceive('listMessages')->once()); @@ -51,7 +52,7 @@ public function it_can_pop_message_from_queue() $this->assertInstanceOf(AzureJob::class, $message); } - /** @test */ + #[Test] public function it_can_pop_message_from_queue_using_default() { $this->setListMessagesReturnExpectation($this->azure->shouldReceive('listMessages')->once()); @@ -61,7 +62,7 @@ public function it_can_pop_message_from_queue_using_default() $this->assertEquals('myqueue', $message->getQueue()); } - /** @test */ + #[Test] public function it_returns_null_if_no_messages_to_pop() { $this->setListMessagesReturnExpectation($this->azure->shouldReceive('listMessages')->once(), 0); @@ -70,7 +71,7 @@ public function it_returns_null_if_no_messages_to_pop() $this->assertNull($message); } - /** @test */ + #[Test] public function it_passes_visibility_timeout_set_in_config() { $mockClient = $this->azure->shouldReceive('listMessages')->once()->withArgs(function ($queue, @@ -82,7 +83,7 @@ public function it_passes_visibility_timeout_set_in_config() $this->queue->pop('myqueue'); } - /** @test */ + #[Test] public function it_only_fetches_first_message() { $mockClient = $this->azure->shouldReceive('listMessages')->once()->withArgs(function ($queue, @@ -93,13 +94,13 @@ public function it_only_fetches_first_message() $this->queue->pop('myqueue'); } - /** @test */ + #[Test] public function it_can_get_visibility_timeout() { $this->assertEquals(5, $this->queue->getVisibilityTimeout()); } - /** @test */ + #[Test] public function it_can_queue_a_job_for_later() { $this->azure->shouldReceive('createMessage')->once()->withArgs(function ($queue, @@ -112,7 +113,7 @@ public function it_can_queue_a_job_for_later() $this->queue->later(10, 'foojob', 'bardata', 'myqueue'); } - /** @test */ + #[Test] public function it_can_get_queue_size() { $this->azure->shouldReceive('getQueueMetadata')->with('myqueue')->andReturn(new GetQueueMetadataResult(5, [])); @@ -120,7 +121,7 @@ public function it_can_get_queue_size() $this->assertEquals(5, $this->queue->size('myqueue')); } - /** @test */ + #[Test] public function it_can_get_azure_instance() { $this->assertInstanceOf(IQueue::class, $this->queue->getAzure()); diff --git a/tests/TestCase.php b/tests/TestCase.php index 0076eb4..0af68ff 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,6 +1,7 @@ addToAssertionCount(Mockery::getContainer()->mockery_getExpectationCount()); Mockery::close(); + HandleExceptions::flushState(); } }