From ccbba4d1925613005268aedc66093ec26c039817 Mon Sep 17 00:00:00 2001 From: Shift Date: Tue, 6 Feb 2024 17:23:24 +0000 Subject: [PATCH 1/8] Bump PHPUnit dependencies --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2957977..82ccb12 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "guzzlehttp/guzzle": "^7.0" }, "require-dev": { - "phpunit/phpunit": "^9", + "phpunit/phpunit": "^10.0", "phpstan/phpstan": "^0.12", "php-coveralls/php-coveralls": "^2.4" }, From 8751520e48ec37bf71dc750c41e73fc0c500d8c1 Mon Sep 17 00:00:00 2001 From: Shift Date: Tue, 6 Feb 2024 17:23:25 +0000 Subject: [PATCH 2/8] Set return type of base TestCase methods From the [PHPUnit 8 release notes][1], the `TestCase` methods below now declare a `void` return type: - `setUpBeforeClass()` - `setUp()` - `assertPreConditions()` - `assertPostConditions()` - `tearDown()` - `tearDownAfterClass()` - `onNotSuccessfulTest()` [1]: https://phpunit.de/announcements/phpunit-8.html --- tests/TestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/TestCase.php b/tests/TestCase.php index 329f446..0c58325 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -15,7 +15,7 @@ abstract class TestCase extends BaseTestCase protected $api; protected $test_class; - public function setUp(): void + protected function setUp(): void { parent::setUp(); From dbf090aba2db94d52b2add2be4764ab65e1d9f50 Mon Sep 17 00:00:00 2001 From: Shift Date: Tue, 6 Feb 2024 17:23:25 +0000 Subject: [PATCH 3/8] Ignore PHPUnit cache folder --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index bf4e8d7..6442ec6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ /vendor/ -/.phpunit.result.cache +/.phpunit.cache /composer.lock \ No newline at end of file From 027d017469ef58a976a2d18d6a7d118b8507a5a3 Mon Sep 17 00:00:00 2001 From: Shift Date: Tue, 6 Feb 2024 17:23:25 +0000 Subject: [PATCH 4/8] Add return types to test methods --- tests/Unit/DeadLetterQueue.php | 8 ++++---- tests/Unit/DeliveredMessage.php | 6 +++--- tests/Unit/ErrorHandling.php | 4 ++-- tests/Unit/Message.php | 10 +++++----- tests/Unit/Queue.php | 12 ++++++------ tests/Unit/Topic.php | 10 +++++----- tests/Unit/Webhook.php | 14 +++++++------- 7 files changed, 32 insertions(+), 32 deletions(-) diff --git a/tests/Unit/DeadLetterQueue.php b/tests/Unit/DeadLetterQueue.php index e1e0e1a..0229200 100644 --- a/tests/Unit/DeadLetterQueue.php +++ b/tests/Unit/DeadLetterQueue.php @@ -8,7 +8,7 @@ class DeadLetterQueue extends TestCase { protected $test_class = \Northwestern\SysDev\SOA\EventHub\DeadLetterQueue::class; - public function test_get_info() + public function test_get_info(): void { $response = '{"name":"etsysdev.test.queue.name.DLQ","realName":"Consumer.sysdev-test-acct.VirtualTopic.etsysdev.test.queue.name.DLQ","eventHubAccount":"sysdev-test-acct","destinationType":"DLQ","queueStatistics":[{"label":"QueueSize","maximum":null,"minimum":null,"startTime":null,"sum":null,"current":null,"sampleSize":null,"average":null},{"label":"EnqueueCount","maximum":null,"minimum":null,"startTime":null,"sum":null,"current":null,"sampleSize":null,"average":null},{"label":"EnqueueTime","maximum":null,"minimum":null,"startTime":null,"sum":null,"current":null,"sampleSize":null,"average":null},{"label":"ExpiredCount","maximum":null,"minimum":null,"startTime":null,"sum":null,"current":null,"sampleSize":null,"average":null},{"label":"DispatchCount","maximum":null,"minimum":null,"startTime":null,"sum":null,"current":null,"sampleSize":null,"average":null},{"label":"DequeueCount","maximum":null,"minimum":null,"startTime":null,"sum":null,"current":null,"sampleSize":null,"average":null}]}'; @@ -23,7 +23,7 @@ public function test_get_info() $this->assertEquals('etsysdev.test.queue.name.DLQ', $dlq['name']); } // end test_get_info - public function test_move_to_dlq() + public function test_move_to_dlq(): void { $this->api->setHttpClient($this->mockHttpResponse(204, null)); @@ -31,7 +31,7 @@ public function test_move_to_dlq() $this->assertTrue($status); } // end test_move_to_dlq - public function test_read_oldest() + public function test_read_oldest(): void { $response_id = 'ID:12345:baz'; $response_body = ['cool' => 'message']; @@ -54,7 +54,7 @@ public function test_read_oldest() $this->assertNull($message); } // end test_read_oldest - public function test_move_from_dlq() + public function test_move_from_dlq(): void { $this->api->setHttpClient($this->mockHttpResponse(204, null)); diff --git a/tests/Unit/DeliveredMessage.php b/tests/Unit/DeliveredMessage.php index 0e8743b..e4b8e85 100644 --- a/tests/Unit/DeliveredMessage.php +++ b/tests/Unit/DeliveredMessage.php @@ -7,14 +7,14 @@ class DeliveredMessage extends TestCase { - public function test_opens_json_message() + public function test_opens_json_message(): void { $msg = new DeliveredMessageModel('ID:12345', '{"test": true}'); $this->assertArrayHasKey('test', $msg->getMessage()); } // end test_opens_json_message - public function test_raw_xml_available() + public function test_raw_xml_available(): void { $xml = 'ToveJaniReminderDo the thing this weekend!'; $msg = new DeliveredMessageModel('ID:12345', $xml); @@ -23,7 +23,7 @@ public function test_raw_xml_available() $this->assertEquals($xml, $msg->getRawMessage()); } // end test_raw_xml_available - public function test_has_message_id() + public function test_has_message_id(): void { $id = 'ID:12345'; $msg = new DeliveredMessageModel($id, ''); diff --git a/tests/Unit/ErrorHandling.php b/tests/Unit/ErrorHandling.php index 8dafd9e..ba4296b 100644 --- a/tests/Unit/ErrorHandling.php +++ b/tests/Unit/ErrorHandling.php @@ -9,7 +9,7 @@ class ErrorHandling extends TestCase // Doesn't matter, they all use EventHubBase, which is what we're testing. protected $test_class = \Northwestern\SysDev\SOA\EventHub\Topic::class; - public function test_connection_problem() + public function test_connection_problem(): void { $this->expectException(\Northwestern\SysDev\SOA\EventHub\Exception\EventHubDown::class); @@ -18,7 +18,7 @@ public function test_connection_problem() $this->api->listAll(); } // end test_connection_problem - public function test_unauthorized_access() + public function test_unauthorized_access(): void { $this->expectException(\Northwestern\SysDev\SOA\EventHub\Exception\EventHubError::class); $this->expectExceptionCode(500); diff --git a/tests/Unit/Message.php b/tests/Unit/Message.php index e43a16e..47333e4 100644 --- a/tests/Unit/Message.php +++ b/tests/Unit/Message.php @@ -8,7 +8,7 @@ class Message extends TestCase { protected $test_class = \Northwestern\SysDev\SOA\EventHub\Message::class; - public function test_read_oldest() + public function test_read_oldest(): void { $response_id = 'ID:12345:baz'; $response_body = ['cool' => 'message']; @@ -31,20 +31,20 @@ public function test_read_oldest() $this->assertNull($message); } // end test_read_oldest - public function test_acknowledge_oldest() + public function test_acknowledge_oldest(): void { $this->api->setHttpClient($this->mockHttpResponse(204, null)); $status = $this->api->acknowledgeOldest('etsysdev.test.queue.name'); $this->assertTrue($status); } // end test_acknowledge_oldest - public function test_read() + public function test_read(): void { // Does not currently work in EventHub $this->markTestIncomplete(); } // end test_read - public function test_acknowledge() + public function test_acknowledge(): void { // With fastForward arg $this->api->setHttpClient($this->mockHttpResponse(204, null)); @@ -57,7 +57,7 @@ public function test_acknowledge() $this->assertTrue($status); } // end test_acknowledge - public function test_move() + public function test_move(): void { // With delay arg $this->api->setHttpClient($this->mockHttpResponse(204, null)); diff --git a/tests/Unit/Queue.php b/tests/Unit/Queue.php index 93a9666..1d32565 100644 --- a/tests/Unit/Queue.php +++ b/tests/Unit/Queue.php @@ -8,7 +8,7 @@ class Queue extends TestCase { protected $test_class = \Northwestern\SysDev\SOA\EventHub\Queue::class; - public function test_list_all() + public function test_list_all(): void { $response = '[{"eventHubAccount":"sysdev-test-acct","topicName":"etsysdev.test.queue.name","readTimeout":1000,"autoAcknowledge":false,"queueRealName":"Consumer.sysdev-test-acct.VirtualTopic.etsysdev.test.queue.name","alertAddress":"nicholas.evans@northwestern.edu","queueStatistics":[{"label":"QueueSize","maximum":0,"minimum":0,"startTime":"2018-10-31T06:39:00","sum":null,"average":0,"current":0,"sampleSize":null},{"label":"EnqueueCount","maximum":null,"minimum":null,"startTime":"2018-10-31T06:39:00","sum":0,"average":null,"current":null,"sampleSize":null},{"label":"EnqueueTime","maximum":2076194,"minimum":5738,"startTime":"2018-10-31T06:39:00","sum":null,"average":791356.4578313242,"current":null,"sampleSize":null},{"label":"ExpiredCount","maximum":null,"minimum":null,"startTime":"2018-10-31T06:39:00","sum":0,"average":null,"current":null,"sampleSize":null},{"label":"DispatchCount","maximum":null,"minimum":null,"startTime":"2018-10-31T06:39:00","sum":0,"average":null,"current":null,"sampleSize":null},{"label":"DequeueCount","maximum":null,"minimum":null,"startTime":"2018-10-31T06:39:00","sum":0,"average":null,"current":null,"sampleSize":null}],"selfPublishingAllowed":true,"destinationType":"QUEUE","name":"etsysdev.test.queue.name","realName":"Consumer.sysdev-test-acct.VirtualTopic.etsysdev.test.queue.name","hasMessage":false,"dlqName":"Consumer.sysdev-test-acct.VirtualTopic.etsysdev.test.queue.name.DLQ"}]'; @@ -23,7 +23,7 @@ public function test_list_all() $this->assertEquals('etsysdev.test.queue.name', $queues[0]['topicName']); } // end test_list_all - public function test_get_info() + public function test_get_info(): void { $response = '{"eventHubAccount":"sysdev-test-acct","topicName":"etsysdev.test.queue.name","readTimeout":1000,"autoAcknowledge":false,"queueRealName":"Consumer.sysdev-test-acct.VirtualTopic.etsysdev.test.queue.name","alertAddress":"nicholas.evans@northwestern.edu","queueStatistics":[{"label":"QueueSize","maximum":0,"minimum":0,"startTime":"2018-10-31T06:39:00","sum":null,"average":0,"current":0,"sampleSize":null},{"label":"EnqueueCount","maximum":null,"minimum":null,"startTime":"2018-10-31T06:39:00","sum":0,"average":null,"current":null,"sampleSize":null},{"label":"EnqueueTime","maximum":2076194,"minimum":5738,"startTime":"2018-10-31T06:39:00","sum":null,"average":791356.4578313242,"current":null,"sampleSize":null},{"label":"ExpiredCount","maximum":null,"minimum":null,"startTime":"2018-10-31T06:39:00","sum":0,"average":null,"current":null,"sampleSize":null},{"label":"DispatchCount","maximum":null,"minimum":null,"startTime":"2018-10-31T06:39:00","sum":0,"average":null,"current":null,"sampleSize":null},{"label":"DequeueCount","maximum":null,"minimum":null,"startTime":"2018-10-31T06:39:00","sum":0,"average":null,"current":null,"sampleSize":null}],"selfPublishingAllowed":true,"destinationType":"QUEUE","name":"etsysdev.test.queue.name","realName":"Consumer.sysdev-test-acct.VirtualTopic.etsysdev.test.queue.name","hasMessage":false,"dlqName":"Consumer.sysdev-test-acct.VirtualTopic.etsysdev.test.queue.name.DLQ"}'; @@ -38,7 +38,7 @@ public function test_get_info() $this->assertEquals('etsysdev.test.queue.name', $queue['topicName']); } // end test_get_info - public function test_clear_all_messages() + public function test_clear_all_messages(): void { $this->api->setHttpClient($this->mockHttpResponse(204, '')); $status = $this->api->clearAllMessages('etsysdev.test.queue.name'); @@ -46,7 +46,7 @@ public function test_clear_all_messages() $this->assertTrue($status); } // end test_clear_all_messages - public function test_configure() + public function test_configure(): void { $response = '{"eventHubAccount":"sysdev-test-acct","topicName":"etsysdev.test.queue.name","readTimeout":1000,"autoAcknowledge":false,"queueRealName":"Consumer.sysdev-test-acct.VirtualTopic.etsysdev.test.queue.name","alertAddress":"nicholas.evans@northwestern.edu","queueStatistics":[],"selfPublishingAllowed":true,"destinationType":"QUEUE","name":"etsysdev.test.queue.name","realName":"Consumer.sysdev-test-acct.VirtualTopic.etsysdev.test.queue.name","hasMessage":false,"dlqName":"Consumer.sysdev-test-acct.VirtualTopic.etsysdev.test.queue.name.DLQ"}'; @@ -55,7 +55,7 @@ public function test_configure() $this->assertEquals('etsysdev.test.queue.name', $queue['topicName']); } // end test_configure - public function test_send_test_json_message() + public function test_send_test_json_message(): void { $response_id = 'ID:12345:baz'; $this->api->setHttpClient($this->mockHttpResponse(204, null, ['X-message-id' => $response_id])); @@ -64,7 +64,7 @@ public function test_send_test_json_message() $this->assertEquals($response_id, $message_id); } // end test_send_test_json_message - public function test_send_test_message() + public function test_send_test_message(): void { $response_id = 'ID:12345:baz'; $this->api->setHttpClient($this->mockHttpResponse(204, null, ['X-message-id' => $response_id])); diff --git a/tests/Unit/Topic.php b/tests/Unit/Topic.php index 249bdee..e0b0e7c 100644 --- a/tests/Unit/Topic.php +++ b/tests/Unit/Topic.php @@ -8,7 +8,7 @@ class Topic extends TestCase { protected $test_class = \Northwestern\SysDev\SOA\EventHub\Topic::class; - public function test_list_all() + public function test_list_all(): void { $response = '[{"eventHubAccount":"sysdev-test-acct","topicName":"etsysdev.test.queue.name","readTimeout":1000,"autoAcknowledge":false,"queueRealName":"Consumer.sysdev-test-acct.VirtualTopic.etsysdev.test.queue.name","alertAddress":"nicholas.evans@northwestern.edu","queueStatistics":[{"label":"QueueSize","maximum":1,"minimum":0,"startTime":"2018-10-30T14:18:00","sum":null,"current":0,"sampleSize":null,"average":0.5},{"label":"EnqueueCount","maximum":null,"minimum":null,"startTime":"2018-10-30T14:18:00","sum":1,"current":null,"sampleSize":null,"average":null},{"label":"EnqueueTime","maximum":2076194,"minimum":5738,"startTime":"2018-10-30T14:18:00","sum":null,"current":null,"sampleSize":null,"average":784116.5967366379},{"label":"ExpiredCount","maximum":null,"minimum":null,"startTime":"2018-10-30T14:18:00","sum":1,"current":null,"sampleSize":null,"average":null},{"label":"DispatchCount","maximum":null,"minimum":null,"startTime":"2018-10-30T14:18:00","sum":9,"current":null,"sampleSize":null,"average":null},{"label":"DequeueCount","maximum":null,"minimum":null,"startTime":"2018-10-30T14:18:00","sum":1,"current":null,"sampleSize":null,"average":null}],"selfPublishingAllowed":true,"destinationType":"QUEUE","name":"etsysdev.test.queue.name","realName":"Consumer.sysdev-test-acct.VirtualTopic.etsysdev.test.queue.name","hasMessage":false,"dlqName":"Consumer.sysdev-test-acct.VirtualTopic.etsysdev.test.queue.name.DLQ"}]'; @@ -23,7 +23,7 @@ public function test_list_all() $this->assertEquals('etsysdev.test.queue.name', $queues[0]['topicName']); } // end test_list_all - public function test_get_info() + public function test_get_info(): void { $response = '{"eventHubAccount":"sysdev-test-acct","topicName":"etsysdev.test.queue.name","readTimeout":1000,"autoAcknowledge":false,"queueRealName":"Consumer.sysdev-test-acct.VirtualTopic.etsysdev.test.queue.name","alertAddress":"nicholas.evans@northwestern.edu","queueStatistics":[{"label":"QueueSize","startTime":"2018-10-30T14:22:00","maximum":1,"minimum":0,"current":0,"sum":null,"average":0.5,"sampleSize":null},{"label":"EnqueueCount","startTime":"2018-10-30T14:22:00","maximum":null,"minimum":null,"current":null,"sum":1,"average":null,"sampleSize":null},{"label":"EnqueueTime","startTime":"2018-10-30T14:22:00","maximum":2076194,"minimum":5738,"current":null,"sum":null,"average":785780.1386910215,"sampleSize":null},{"label":"ExpiredCount","startTime":"2018-10-30T14:22:00","maximum":null,"minimum":null,"current":null,"sum":1,"average":null,"sampleSize":null},{"label":"DispatchCount","startTime":"2018-10-30T14:22:00","maximum":null,"minimum":null,"current":null,"sum":9,"average":null,"sampleSize":null},{"label":"DequeueCount","startTime":"2018-10-30T14:22:00","maximum":null,"minimum":null,"current":null,"sum":1,"average":null,"sampleSize":null}],"selfPublishingAllowed":true,"destinationType":"QUEUE","name":"etsysdev.test.queue.name","realName":"Consumer.sysdev-test-acct.VirtualTopic.etsysdev.test.queue.name","hasMessage":false,"dlqName":"Consumer.sysdev-test-acct.VirtualTopic.etsysdev.test.queue.name.DLQ"}'; @@ -38,7 +38,7 @@ public function test_get_info() $this->assertEquals('etsysdev.test.queue.name', $queue['topicName']); } // end test_get_info - public function test_configure() + public function test_configure(): void { $response = '{"eventHubAccount":"sysdev-test-acct","topicName":"etsysdev.test.queue.name","readTimeout":1000,"autoAcknowledge":false,"queueRealName":"Consumer.sysdev-test-acct.VirtualTopic.etsysdev.test.queue.name","alertAddress":"nicholas.evans@northwestern.edu","queueStatistics":[],"selfPublishingAllowed":true,"destinationType":"QUEUE","name":"etsysdev.test.queue.name","realName":"Consumer.sysdev-test-acct.VirtualTopic.etsysdev.test.queue.name","hasMessage":false,"dlqName":"Consumer.sysdev-test-acct.VirtualTopic.etsysdev.test.queue.name.DLQ"}'; $this->api->setHttpClient($this->mockHttpResponse(200, $response)); @@ -47,7 +47,7 @@ public function test_configure() $this->assertEquals('etsysdev.test.queue.name', $config['topicName']); } // end test_configure - public function test_write_json_message() + public function test_write_json_message(): void { $response_id = 'ID:12345:baz'; $this->api->setHttpClient($this->mockHttpResponse(204, null, ['X-message-id' => $response_id])); @@ -56,7 +56,7 @@ public function test_write_json_message() $this->assertEquals($response_id, $message_id); } // end test_write_json_message - public function test_write_message() + public function test_write_message(): void { $response_id = 'ID:12345:baz'; $this->api->setHttpClient($this->mockHttpResponse(204, null, ['X-message-id' => $response_id])); diff --git a/tests/Unit/Webhook.php b/tests/Unit/Webhook.php index af1312e..3c35e9d 100644 --- a/tests/Unit/Webhook.php +++ b/tests/Unit/Webhook.php @@ -8,7 +8,7 @@ class Webhook extends TestCase { protected $test_class = \Northwestern\SysDev\SOA\EventHub\Webhook::class; - public function test_list_all() + public function test_list_all(): void { $response = '{"eventHubAccount":"sysdev-test-acct","webhooks":[{"topicName":"etsysdev.test.queue.name","callbackURL":"\/v1\/event-hub\/webhook\/etsysdev.test.queue.name"}]}'; $this->api->setHttpClient($this->mockHttpResponse(200, $response)); @@ -17,7 +17,7 @@ public function test_list_all() $this->assertArrayHasKey('webhooks', $hooks); } // end test_list_all - public function test_get_info() + public function test_get_info(): void { $response = '{"topicName":"etsysdev.test.queue.name","endpoint":"http:\/\/localhost:9080\/GenericMQ\/test\/apikey","securityTypes":["NONE"],"contentType":"application\/json","active":false,"webhookSecurity":[],"webhookStatistics":[],"event_hub_account":"sysdev-test-acct"}'; $this->api->setHttpClient($this->mockHttpResponse(200, $response)); @@ -26,7 +26,7 @@ public function test_get_info() $this->assertEquals('etsysdev.test.queue.name', $hook['topicName']); } // end test_get_info - public function test_delete() + public function test_delete(): void { $this->api->setHttpClient($this->mockHttpResponse(204, '')); @@ -34,7 +34,7 @@ public function test_delete() $this->assertTrue($status); } // end test_delete - public function test_create() + public function test_create(): void { $this->api->setHttpClient($this->mockHttpResponse(204, '')); @@ -42,7 +42,7 @@ public function test_create() $this->assertTrue($status); } // end test_create - public function test_update_config() + public function test_update_config(): void { $response = '{"topicName":"etsysdev.test.queue.name","endpoint":"http:\/\/localhost:9080\/GenericMQ\/test\/apikey","securityTypes":["NONE"],"contentType":"application\/json","active":true,"webhookSecurity":[],"webhookStatistics":null,"event_hub_account":"sysdev-test-acct"}'; $this->api->setHttpClient($this->mockHttpResponse(200, $response)); @@ -51,7 +51,7 @@ public function test_update_config() $this->assertEquals('etsysdev.test.queue.name', $hook['topicName']); } // end test_update_config - public function test_pause() + public function test_pause(): void { $response = '{"topicName":"etsysdev.test.queue.name","endpoint":"http:\/\/localhost:9080\/GenericMQ\/test\/apikey","securityTypes":["NONE"],"contentType":"application\/json","active":false,"webhookSecurity":[],"webhookStatistics":null,"event_hub_account":"sysdev-test-acct"}'; $this->api->setHttpClient($this->mockHttpResponse(200, $response)); @@ -60,7 +60,7 @@ public function test_pause() $this->assertEquals('etsysdev.test.queue.name', $hook['topicName']); } // end test_pause - public function test_unpause() + public function test_unpause(): void { $response = '{"topicName":"etsysdev.test.queue.name","endpoint":"http:\/\/localhost:9080\/GenericMQ\/test\/apikey","securityTypes":["NONE"],"contentType":"application\/json","active":true,"webhookSecurity":[],"webhookStatistics":null,"event_hub_account":"sysdev-test-acct"}'; $this->api->setHttpClient($this->mockHttpResponse(200, $response)); From 4c72def5e86246868ba9af3c59bb46ace8a97da4 Mon Sep 17 00:00:00 2001 From: Shift Date: Tue, 6 Feb 2024 17:23:25 +0000 Subject: [PATCH 5/8] Define test classes as `final` --- tests/Unit/DeadLetterQueue.php | 2 +- tests/Unit/DeliveredMessage.php | 2 +- tests/Unit/ErrorHandling.php | 2 +- tests/Unit/Message.php | 2 +- tests/Unit/Queue.php | 2 +- tests/Unit/Topic.php | 2 +- tests/Unit/Webhook.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/Unit/DeadLetterQueue.php b/tests/Unit/DeadLetterQueue.php index 0229200..e17ffdd 100644 --- a/tests/Unit/DeadLetterQueue.php +++ b/tests/Unit/DeadLetterQueue.php @@ -4,7 +4,7 @@ use Northwestern\SysDev\SOA\EventHub\Tests\TestCase; -class DeadLetterQueue extends TestCase +final class DeadLetterQueue extends TestCase { protected $test_class = \Northwestern\SysDev\SOA\EventHub\DeadLetterQueue::class; diff --git a/tests/Unit/DeliveredMessage.php b/tests/Unit/DeliveredMessage.php index e4b8e85..733e5e1 100644 --- a/tests/Unit/DeliveredMessage.php +++ b/tests/Unit/DeliveredMessage.php @@ -5,7 +5,7 @@ use Northwestern\SysDev\SOA\EventHub\Tests\TestCase; use Northwestern\SysDev\SOA\EventHub\Model\DeliveredMessage as DeliveredMessageModel; // same name as the class, needs an alias to work -class DeliveredMessage extends TestCase +final class DeliveredMessage extends TestCase { public function test_opens_json_message(): void { diff --git a/tests/Unit/ErrorHandling.php b/tests/Unit/ErrorHandling.php index ba4296b..58f41e7 100644 --- a/tests/Unit/ErrorHandling.php +++ b/tests/Unit/ErrorHandling.php @@ -4,7 +4,7 @@ use Northwestern\SysDev\SOA\EventHub\Tests\TestCase; -class ErrorHandling extends TestCase +final class ErrorHandling extends TestCase { // Doesn't matter, they all use EventHubBase, which is what we're testing. protected $test_class = \Northwestern\SysDev\SOA\EventHub\Topic::class; diff --git a/tests/Unit/Message.php b/tests/Unit/Message.php index 47333e4..c9f83e9 100644 --- a/tests/Unit/Message.php +++ b/tests/Unit/Message.php @@ -4,7 +4,7 @@ use Northwestern\SysDev\SOA\EventHub\Tests\TestCase; -class Message extends TestCase +final class Message extends TestCase { protected $test_class = \Northwestern\SysDev\SOA\EventHub\Message::class; diff --git a/tests/Unit/Queue.php b/tests/Unit/Queue.php index 1d32565..74a528e 100644 --- a/tests/Unit/Queue.php +++ b/tests/Unit/Queue.php @@ -4,7 +4,7 @@ use Northwestern\SysDev\SOA\EventHub\Tests\TestCase; -class Queue extends TestCase +final class Queue extends TestCase { protected $test_class = \Northwestern\SysDev\SOA\EventHub\Queue::class; diff --git a/tests/Unit/Topic.php b/tests/Unit/Topic.php index e0b0e7c..57ddd7b 100644 --- a/tests/Unit/Topic.php +++ b/tests/Unit/Topic.php @@ -4,7 +4,7 @@ use Northwestern\SysDev\SOA\EventHub\Tests\TestCase; -class Topic extends TestCase +final class Topic extends TestCase { protected $test_class = \Northwestern\SysDev\SOA\EventHub\Topic::class; diff --git a/tests/Unit/Webhook.php b/tests/Unit/Webhook.php index 3c35e9d..31ed57c 100644 --- a/tests/Unit/Webhook.php +++ b/tests/Unit/Webhook.php @@ -4,7 +4,7 @@ use Northwestern\SysDev\SOA\EventHub\Tests\TestCase; -class Webhook extends TestCase +final class Webhook extends TestCase { protected $test_class = \Northwestern\SysDev\SOA\EventHub\Webhook::class; From 580e947735c5206984a94c4a4359c2d4b7e76832 Mon Sep 17 00:00:00 2001 From: Nick Evans Date: Tue, 6 Feb 2024 11:36:55 -0600 Subject: [PATCH 6/8] Update for PHPUnit 10 & drop 7.4 support --- .github/workflows/phpunit.yml | 2 +- .gitignore | 3 ++- composer.json | 2 +- phpunit.xml | 14 +++++++------- tests/{TestCase.php => SdkBaseTestCase.php} | 2 +- tests/Unit/DeadLetterQueue.php | 4 ++-- tests/Unit/DeliveredMessage.php | 4 ++-- tests/Unit/ErrorHandling.php | 4 ++-- tests/Unit/Message.php | 4 ++-- tests/Unit/Queue.php | 4 ++-- tests/Unit/Topic.php | 4 ++-- tests/Unit/Webhook.php | 4 ++-- 12 files changed, 26 insertions(+), 25 deletions(-) rename tests/{TestCase.php => SdkBaseTestCase.php} (96%) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 87baf1b..e7ed4c7 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3'] + php-versions: ['8.0', '8.1', '8.2', '8.3'] steps: - uses: actions/checkout@v2 diff --git a/.gitignore b/.gitignore index 6442ec6..a746b1b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /vendor/ /.phpunit.cache -/composer.lock \ No newline at end of file +/composer.lock +/.phpunit.result.cache \ No newline at end of file diff --git a/composer.json b/composer.json index 82ccb12..eb27932 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": ">=7.4", + "php": ">=8.0", "guzzlehttp/guzzle": "^7.0" }, "require-dev": { diff --git a/phpunit.xml b/phpunit.xml index 0efe8a0..d8f6cb6 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,13 +1,13 @@ - - - - ./src - - + - ./tests + ./tests/Unit + + + ./src + + diff --git a/tests/TestCase.php b/tests/SdkBaseTestCase.php similarity index 96% rename from tests/TestCase.php rename to tests/SdkBaseTestCase.php index 0c58325..c60a35a 100644 --- a/tests/TestCase.php +++ b/tests/SdkBaseTestCase.php @@ -10,7 +10,7 @@ use GuzzleHttp\Exception\RequestException; use PHPUnit\Framework\TestCase as BaseTestCase; -abstract class TestCase extends BaseTestCase +abstract class SdkBaseTestCase extends BaseTestCase { protected $api; protected $test_class; diff --git a/tests/Unit/DeadLetterQueue.php b/tests/Unit/DeadLetterQueue.php index e17ffdd..99b7a0e 100644 --- a/tests/Unit/DeadLetterQueue.php +++ b/tests/Unit/DeadLetterQueue.php @@ -2,9 +2,9 @@ namespace Northwestern\SysDev\SOA\EventHub\Tests\Unit; -use Northwestern\SysDev\SOA\EventHub\Tests\TestCase; +use Northwestern\SysDev\SOA\EventHub\Tests\SdkBaseTestCase; -final class DeadLetterQueue extends TestCase +final class DeadLetterQueue extends SdkBaseTestCase { protected $test_class = \Northwestern\SysDev\SOA\EventHub\DeadLetterQueue::class; diff --git a/tests/Unit/DeliveredMessage.php b/tests/Unit/DeliveredMessage.php index 733e5e1..195e790 100644 --- a/tests/Unit/DeliveredMessage.php +++ b/tests/Unit/DeliveredMessage.php @@ -2,10 +2,10 @@ namespace Northwestern\SysDev\SOA\EventHub\Tests\Unit; -use Northwestern\SysDev\SOA\EventHub\Tests\TestCase; +use Northwestern\SysDev\SOA\EventHub\Tests\SdkBaseTestCase; use Northwestern\SysDev\SOA\EventHub\Model\DeliveredMessage as DeliveredMessageModel; // same name as the class, needs an alias to work -final class DeliveredMessage extends TestCase +final class DeliveredMessage extends SdkBaseTestCase { public function test_opens_json_message(): void { diff --git a/tests/Unit/ErrorHandling.php b/tests/Unit/ErrorHandling.php index 58f41e7..fb98c85 100644 --- a/tests/Unit/ErrorHandling.php +++ b/tests/Unit/ErrorHandling.php @@ -2,9 +2,9 @@ namespace Northwestern\SysDev\SOA\EventHub\Tests\Unit; -use Northwestern\SysDev\SOA\EventHub\Tests\TestCase; +use Northwestern\SysDev\SOA\EventHub\Tests\SdkBaseTestCase; -final class ErrorHandling extends TestCase +final class ErrorHandling extends SdkBaseTestCase { // Doesn't matter, they all use EventHubBase, which is what we're testing. protected $test_class = \Northwestern\SysDev\SOA\EventHub\Topic::class; diff --git a/tests/Unit/Message.php b/tests/Unit/Message.php index c9f83e9..01869a5 100644 --- a/tests/Unit/Message.php +++ b/tests/Unit/Message.php @@ -2,9 +2,9 @@ namespace Northwestern\SysDev\SOA\EventHub\Tests\Unit; -use Northwestern\SysDev\SOA\EventHub\Tests\TestCase; +use Northwestern\SysDev\SOA\EventHub\Tests\SdkBaseTestCase; -final class Message extends TestCase +final class Message extends SdkBaseTestCase { protected $test_class = \Northwestern\SysDev\SOA\EventHub\Message::class; diff --git a/tests/Unit/Queue.php b/tests/Unit/Queue.php index 74a528e..6c855e1 100644 --- a/tests/Unit/Queue.php +++ b/tests/Unit/Queue.php @@ -2,9 +2,9 @@ namespace Northwestern\SysDev\SOA\EventHub\Tests\Unit; -use Northwestern\SysDev\SOA\EventHub\Tests\TestCase; +use Northwestern\SysDev\SOA\EventHub\Tests\SdkBaseTestCase; -final class Queue extends TestCase +final class Queue extends SdkBaseTestCase { protected $test_class = \Northwestern\SysDev\SOA\EventHub\Queue::class; diff --git a/tests/Unit/Topic.php b/tests/Unit/Topic.php index 57ddd7b..8523525 100644 --- a/tests/Unit/Topic.php +++ b/tests/Unit/Topic.php @@ -2,9 +2,9 @@ namespace Northwestern\SysDev\SOA\EventHub\Tests\Unit; -use Northwestern\SysDev\SOA\EventHub\Tests\TestCase; +use Northwestern\SysDev\SOA\EventHub\Tests\SdkBaseTestCase; -final class Topic extends TestCase +final class Topic extends SdkBaseTestCase { protected $test_class = \Northwestern\SysDev\SOA\EventHub\Topic::class; diff --git a/tests/Unit/Webhook.php b/tests/Unit/Webhook.php index 31ed57c..e93faca 100644 --- a/tests/Unit/Webhook.php +++ b/tests/Unit/Webhook.php @@ -2,9 +2,9 @@ namespace Northwestern\SysDev\SOA\EventHub\Tests\Unit; -use Northwestern\SysDev\SOA\EventHub\Tests\TestCase; +use Northwestern\SysDev\SOA\EventHub\Tests\SdkBaseTestCase; -final class Webhook extends TestCase +final class Webhook extends SdkBaseTestCase { protected $test_class = \Northwestern\SysDev\SOA\EventHub\Webhook::class; From df207388020fa8fc8473df2b0e1c3635d73ecbb8 Mon Sep 17 00:00:00 2001 From: Nick Evans Date: Tue, 6 Feb 2024 11:44:35 -0600 Subject: [PATCH 7/8] 8.0 also out --- .github/workflows/phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index e7ed4c7..a390582 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - php-versions: ['8.0', '8.1', '8.2', '8.3'] + php-versions: ['8.1', '8.2', '8.3'] steps: - uses: actions/checkout@v2 From f4ea8146feab65ad98eb49adf4dc742126d28472 Mon Sep 17 00:00:00 2001 From: Nick Evans Date: Tue, 6 Feb 2024 11:45:48 -0600 Subject: [PATCH 8/8] Update CHANGELOG.md --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d589a8..1beaf34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,12 @@ # CHANGELOG +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] +### Changed +- Support for PHP 7.4 and 8.0 has been dropped. Please use v2.0.0 if you need to use this with an older version of PHP. ## v2.0.0 There are **no breaking changes** to the library, but the minimum PHP version is now 7.4.