From 37908a3395ec08f4dfb8de221b01b0236bb275ea Mon Sep 17 00:00:00 2001 From: Marcus Frolander Date: Sun, 28 Apr 2019 18:20:48 +0200 Subject: [PATCH 01/13] Laravel 5.8 - Adding support for Laravel 5.8 - Removing support for Laravel 5.3 and 5.4 **(see notes)** - Restricting PHP Version to 7.2 or above as per https://laravel.com/docs/5.8/installation and https://phpunit.de/announcements/phpunit-8.html - Upping PHPUnit requirement to `~8.0`. Laravel 5.8 still technically supports PHPUnit 7 - but Laravel 5.9 very likely won't. --- composer.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 0574cce..70d316b 100644 --- a/composer.json +++ b/composer.json @@ -12,16 +12,16 @@ } ], "require": { - "php": ">=5.6.4", + "php": ">=7.2", "guzzlehttp/guzzle": "^6.2", - "illuminate/notifications": "5.3.*|5.4.*|5.5.*|5.6.*|5.7.*", - "illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*", + "illuminate/notifications": "5.5.*|5.6.*|5.7.*|5.8.*", + "illuminate/support": "5.5.*|5.6.*|5.7.*|5.8.*", "nesbot/carbon": "^1.21" }, "require-dev": { "mockery/mockery": "^0.9.5", - "phpunit/phpunit": "~4.4", - "orchestra/testbench": "~3.3|~3.4" + "phpunit/phpunit": "~8.0", + "orchestra/testbench": "~3.5|~3.6|~3.7|~3.8" }, "autoload": { "psr-4": { From 66ab861bca8f8fc335c4205c1fab7f20f4a9433b Mon Sep 17 00:00:00 2001 From: Marcus Frolander Date: Sun, 28 Apr 2019 18:21:33 +0200 Subject: [PATCH 02/13] Altered PHP Versions - Removed unsupported PHP Versions and added `PHP 7.2` and `PHP 7.3` to test suite. --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0bc8874..82d44bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,8 @@ language: php php: - - 5.6 - - 7.0 - - 7.1 + - 7.2 + - 7.3 env: matrix: From a5aeb5c17081c7af78ceed5ae9b776ebc2a2db74 Mon Sep 17 00:00:00 2001 From: Marcus Frolander Date: Sun, 28 Apr 2019 18:22:04 +0200 Subject: [PATCH 03/13] Missing return type void --- tests/IntegrationTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/IntegrationTest.php b/tests/IntegrationTest.php index e919cb2..cc52e3d 100644 --- a/tests/IntegrationTest.php +++ b/tests/IntegrationTest.php @@ -22,7 +22,7 @@ class IntegrationTest extends TestCase /** @var Dispatcher */ protected $events; - public function setUp() + public function setUp(): void { parent::setUp(); From 0e99397c8a135c3357143c8d687adee1b3ffa3aa Mon Sep 17 00:00:00 2001 From: Marcus Frolander Date: Sun, 28 Apr 2019 18:22:27 +0200 Subject: [PATCH 04/13] Missing return type void --- tests/PushoverChannelTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/PushoverChannelTest.php b/tests/PushoverChannelTest.php index 5d0cfa1..8bddcb1 100644 --- a/tests/PushoverChannelTest.php +++ b/tests/PushoverChannelTest.php @@ -30,7 +30,7 @@ class PushoverChannelTest extends TestCase /** @var Dispatcher */ protected $events; - public function setUp() + public function setUp(): void { parent::setUp(); From a5fe6d09b88b1f6a3420c8d9ef034d09488f4c2c Mon Sep 17 00:00:00 2001 From: Marcus Frolander Date: Sun, 28 Apr 2019 18:22:41 +0200 Subject: [PATCH 05/13] Missing return type void --- tests/PushoverTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/PushoverTest.php b/tests/PushoverTest.php index 5ed701e..ad1fde6 100644 --- a/tests/PushoverTest.php +++ b/tests/PushoverTest.php @@ -19,7 +19,7 @@ class PushoverTest extends TestCase /** @var HttpClient */ protected $guzzleClient; - public function setUp() + public function setUp(): void { parent::setUp(); From 715f14cef924b7f9535a0095e3fa4e4d13d1d1b7 Mon Sep 17 00:00:00 2001 From: Marcus Frolander Date: Sun, 28 Apr 2019 18:22:52 +0200 Subject: [PATCH 06/13] Missing return type void --- tests/PushoverServiceProviderTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/PushoverServiceProviderTest.php b/tests/PushoverServiceProviderTest.php index accbf83..a07f911 100644 --- a/tests/PushoverServiceProviderTest.php +++ b/tests/PushoverServiceProviderTest.php @@ -17,7 +17,7 @@ class PushoverServiceProviderTest extends TestCase /** @var Application */ protected $app; - public function setUp() + public function setUp(): void { parent::setUp(); From bf08885b9457159d0073f13d5dfa35f99f9fec56 Mon Sep 17 00:00:00 2001 From: Marcus Frolander Date: Sun, 28 Apr 2019 18:23:05 +0200 Subject: [PATCH 07/13] Missing return type void --- tests/PushoverReceiverTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/PushoverReceiverTest.php b/tests/PushoverReceiverTest.php index ffd4de5..f8145cb 100644 --- a/tests/PushoverReceiverTest.php +++ b/tests/PushoverReceiverTest.php @@ -9,7 +9,7 @@ class PushoverReceiverTest extends TestCase { private $pushoverReceiver; - public function setUp() + public function setUp(): void { $this->pushoverReceiver = PushoverReceiver::withUserKey('pushover-key'); } From f5dfc28455da187547e6bf3b380dd717ac2c91ab Mon Sep 17 00:00:00 2001 From: Marcus Frolander Date: Sun, 28 Apr 2019 18:23:15 +0200 Subject: [PATCH 08/13] Missing return type void --- tests/PushoverMessageTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/PushoverMessageTest.php b/tests/PushoverMessageTest.php index c4d4b9c..fbb8300 100644 --- a/tests/PushoverMessageTest.php +++ b/tests/PushoverMessageTest.php @@ -12,7 +12,7 @@ class PushoverMessageTest extends TestCase /** @var PushoverMessage */ protected $message; - public function setUp() + public function setUp(): void { parent::setUp(); $this->message = new PushoverMessage(); From f6190e59b25471ade1f85418e489aead6d635eca Mon Sep 17 00:00:00 2001 From: Marcus Frolander Date: Sun, 28 Apr 2019 18:30:54 +0200 Subject: [PATCH 09/13] Updated Mockery requirements. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 70d316b..ed5e393 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "nesbot/carbon": "^1.21" }, "require-dev": { - "mockery/mockery": "^0.9.5", + "mockery/mockery": "^1.0", "phpunit/phpunit": "~8.0", "orchestra/testbench": "~3.5|~3.6|~3.7|~3.8" }, From b495158ea754645805c3d6d4859dd35a8cfb8e2f Mon Sep 17 00:00:00 2001 From: Marcus Frolander Date: Sun, 28 Apr 2019 18:36:05 +0200 Subject: [PATCH 10/13] Update composer.json Adding `"dms/phpunit-arraysubset-asserts": ">=0.1.0"` --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ed5e393..86d21ba 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,8 @@ "require-dev": { "mockery/mockery": "^1.0", "phpunit/phpunit": "~8.0", - "orchestra/testbench": "~3.5|~3.6|~3.7|~3.8" + "orchestra/testbench": "~3.5|~3.6|~3.7|~3.8", + "dms/phpunit-arraysubset-asserts": ">=0.1.0" }, "autoload": { "psr-4": { From cd7a3d9b27102408ea41426459926244d33927a1 Mon Sep 17 00:00:00 2001 From: Marcus Frolander Date: Sun, 28 Apr 2019 18:39:53 +0200 Subject: [PATCH 11/13] Drop-in replacement for assertArraySubset Due to upcoming deprecation. --- tests/PushoverReceiverTest.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/PushoverReceiverTest.php b/tests/PushoverReceiverTest.php index f8145cb..3b4bd00 100644 --- a/tests/PushoverReceiverTest.php +++ b/tests/PushoverReceiverTest.php @@ -3,6 +3,8 @@ namespace NotificationChannels\Pushover\Test; use Orchestra\Testbench\TestCase; +use DMS\PHPUnitExtensions\ArraySubset\Assert; +use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts; use NotificationChannels\Pushover\PushoverReceiver; class PushoverReceiverTest extends TestCase @@ -19,7 +21,7 @@ public function it_can_set_up_a_receiver_with_an_user_key() { $pushoverReceiver = PushoverReceiver::withUserKey('pushover-key'); - $this->assertArraySubset(['user' => 'pushover-key'], $pushoverReceiver->toArray()); + Assert::assertArraySubset(['user' => 'pushover-key'], $pushoverReceiver->toArray()); } /** @test */ @@ -27,7 +29,7 @@ public function it_can_set_up_a_receiver_with_a_group_key() { $pushoverReceiver = PushoverReceiver::withGroupKey('pushover-key'); - $this->assertArraySubset(['user' => 'pushover-key'], $pushoverReceiver->toArray()); + Assert::assertArraySubset(['user' => 'pushover-key'], $pushoverReceiver->toArray()); } /** @test */ @@ -35,7 +37,7 @@ public function it_can_set_up_a_receiver_with_an_application_token() { $pushoverReceiver = PushoverReceiver::withUserKey('pushover-key')->withApplicationToken('pushover-token'); - $this->assertArraySubset(['user' => 'pushover-key', 'token' => 'pushover-token'], $pushoverReceiver->toArray()); + Assert::assertArraySubset(['user' => 'pushover-key', 'token' => 'pushover-token'], $pushoverReceiver->toArray()); } /** @test */ @@ -53,7 +55,7 @@ public function it_can_add_a_single_device_to_the_receiver() { $this->pushoverReceiver->toDevice('iphone'); - $this->assertArraySubset(['device' => 'iphone'], $this->pushoverReceiver->toArray()); + Assert::assertArraySubset(['device' => 'iphone'], $this->pushoverReceiver->toArray()); } /** @test */ @@ -63,7 +65,7 @@ public function it_can_add_multiple_devices_to_the_receiver() ->toDevice('desktop') ->toDevice('macbook'); - $this->assertArraySubset(['device' => 'iphone,desktop,macbook'], $this->pushoverReceiver->toArray()); + Assert::assertArraySubset(['device' => 'iphone,desktop,macbook'], $this->pushoverReceiver->toArray()); } /** @test */ @@ -71,6 +73,6 @@ public function it_can_add_an_array_of_devices_to_the_receiver() { $this->pushoverReceiver->toDevice(['iphone', 'desktop', 'macbook']); - $this->assertArraySubset(['device' => 'iphone,desktop,macbook'], $this->pushoverReceiver->toArray()); + Assert::assertArraySubset(['device' => 'iphone,desktop,macbook'], $this->pushoverReceiver->toArray()); } } From 9cb0b21162668bfd5162f15101022769d2fa1cfc Mon Sep 17 00:00:00 2001 From: Marcus Frolander Date: Sun, 28 Apr 2019 18:44:00 +0200 Subject: [PATCH 12/13] Updated deprecated method calls `setExpectedException` was deprecated. Replaced with `expectException` and `expectExceptionMessage`. --- tests/PushoverTest.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/PushoverTest.php b/tests/PushoverTest.php index ad1fde6..10e71c2 100644 --- a/tests/PushoverTest.php +++ b/tests/PushoverTest.php @@ -72,7 +72,8 @@ public function it_can_accept_parameters_for_a_send_request() /** @test */ public function it_throws_an_exception_when_pushover_returns_an_error_with_invalid_json() { - $this->setExpectedException(CouldNotSendNotification::class, 'Pushover responded with an error (400).'); + $this->expectException(CouldNotSendNotification::class); + $this->expectExceptionMessage('Pushover responded with an error (400).'); $guzzleRequest = Mockery::mock(\Psr\Http\Message\RequestInterface::class); $guzzleResponse = Mockery::mock(\Psr\Http\Message\ResponseInterface::class); @@ -87,7 +88,8 @@ public function it_throws_an_exception_when_pushover_returns_an_error_with_inval /** @test */ public function it_throws_an_exception_when_pushover_returns_an_error_with_valid_json() { - $this->setExpectedException(CouldNotSendNotification::class, 'Pushover responded with an error (400): error_message_1, error_message_2'); + $this->expectException(CouldNotSendNotification::class); + $this->expectExceptionMessage('Pushover responded with an error (400): error_message_1, error_message_2'); $guzzleRequest = Mockery::mock(\Psr\Http\Message\RequestInterface::class); $guzzleResponse = Mockery::mock(\Psr\Http\Message\ResponseInterface::class); @@ -102,7 +104,8 @@ public function it_throws_an_exception_when_pushover_returns_an_error_with_valid /** @test */ public function it_throws_an_exception_when_pushover_returns_nothing() { - $this->setExpectedException(ServiceCommunicationError::class, 'The communication with Pushover failed because'); + $this->expectException(ServiceCommunicationError::class); + $this->expectExceptionMessage('The communication with Pushover failed because'); $guzzleRequest = Mockery::mock(\Psr\Http\Message\RequestInterface::class); @@ -114,7 +117,8 @@ public function it_throws_an_exception_when_pushover_returns_nothing() /** @test */ public function it_throws_an_exception_when_an_unknown_communication_error_occurred() { - $this->setExpectedException(ServiceCommunicationError::class, 'The communication with Pushover failed'); + $this->expectException(ServiceCommunicationError::class); + $this->expectExceptionMessage('The communication with Pushover failed'); $this->guzzleClient->shouldReceive('post')->andThrow(new Exception); From b3416469c8f82f284ce999b1c54dc46cac829c18 Mon Sep 17 00:00:00 2001 From: Marcus Frolander Date: Sun, 28 Apr 2019 18:44:56 +0200 Subject: [PATCH 13/13] Updated deprecated method `setExpectedException` is deprecated. Updated to `expectException`. --- tests/PushoverMessageTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/PushoverMessageTest.php b/tests/PushoverMessageTest.php index fbb8300..4f59465 100644 --- a/tests/PushoverMessageTest.php +++ b/tests/PushoverMessageTest.php @@ -122,7 +122,7 @@ public function it_can_set_a_priority_with_retry_and_expire() /** @test */ public function it_cannot_set_priority_to_emergency_when_not_providing_a_retry_and_expiry_time() { - $this->setExpectedException(EmergencyNotificationRequiresRetryAndExpire::class); + $this->expectException(EmergencyNotificationRequiresRetryAndExpire::class); $this->message->priority(PushoverMessage::EMERGENCY_PRIORITY); }