Skip to content

Commit 82ea738

Browse files
CmdrSharpcasperboone
authored andcommitted
Add Laravel 5.8 support (#30)
* 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. * Altered PHP Versions - Removed unsupported PHP Versions and added `PHP 7.2` and `PHP 7.3` to test suite. * Missing return type void * Missing return type void * Missing return type void * Missing return type void * Missing return type void * Missing return type void * Updated Mockery requirements. * Update composer.json Adding `"dms/phpunit-arraysubset-asserts": ">=0.1.0"` * Drop-in replacement for assertArraySubset Due to upcoming deprecation. * Updated deprecated method calls `setExpectedException` was deprecated. Replaced with `expectException` and `expectExceptionMessage`. * Updated deprecated method `setExpectedException` is deprecated. Updated to `expectException`.
1 parent 5bb4b3e commit 82ea738

File tree

8 files changed

+32
-26
lines changed

8 files changed

+32
-26
lines changed

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
language: php
22

33
php:
4-
- 5.6
5-
- 7.0
6-
- 7.1
4+
- 7.2
5+
- 7.3
76

87
env:
98
matrix:

composer.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,17 @@
1212
}
1313
],
1414
"require": {
15-
"php": ">=5.6.4",
15+
"php": ">=7.2",
1616
"guzzlehttp/guzzle": "^6.2",
17-
"illuminate/notifications": "5.3.*|5.4.*|5.5.*|5.6.*|5.7.*",
18-
"illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*",
17+
"illuminate/notifications": "5.5.*|5.6.*|5.7.*|5.8.*",
18+
"illuminate/support": "5.5.*|5.6.*|5.7.*|5.8.*",
1919
"nesbot/carbon": "^1.21"
2020
},
2121
"require-dev": {
22-
"mockery/mockery": "^0.9.5",
23-
"phpunit/phpunit": "~4.4",
24-
"orchestra/testbench": "~3.3|~3.4"
22+
"mockery/mockery": "^1.0",
23+
"phpunit/phpunit": "~8.0",
24+
"orchestra/testbench": "~3.5|~3.6|~3.7|~3.8",
25+
"dms/phpunit-arraysubset-asserts": ">=0.1.0"
2526
},
2627
"autoload": {
2728
"psr-4": {

tests/IntegrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class IntegrationTest extends TestCase
2222
/** @var Dispatcher */
2323
protected $events;
2424

25-
public function setUp()
25+
public function setUp(): void
2626
{
2727
parent::setUp();
2828

tests/PushoverChannelTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class PushoverChannelTest extends TestCase
3030
/** @var Dispatcher */
3131
protected $events;
3232

33-
public function setUp()
33+
public function setUp(): void
3434
{
3535
parent::setUp();
3636

tests/PushoverMessageTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class PushoverMessageTest extends TestCase
1212
/** @var PushoverMessage */
1313
protected $message;
1414

15-
public function setUp()
15+
public function setUp(): void
1616
{
1717
parent::setUp();
1818
$this->message = new PushoverMessage();
@@ -122,7 +122,7 @@ public function it_can_set_a_priority_with_retry_and_expire()
122122
/** @test */
123123
public function it_cannot_set_priority_to_emergency_when_not_providing_a_retry_and_expiry_time()
124124
{
125-
$this->setExpectedException(EmergencyNotificationRequiresRetryAndExpire::class);
125+
$this->expectException(EmergencyNotificationRequiresRetryAndExpire::class);
126126

127127
$this->message->priority(PushoverMessage::EMERGENCY_PRIORITY);
128128
}

tests/PushoverReceiverTest.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
namespace NotificationChannels\Pushover\Test;
44

55
use Orchestra\Testbench\TestCase;
6+
use DMS\PHPUnitExtensions\ArraySubset\Assert;
7+
use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts;
68
use NotificationChannels\Pushover\PushoverReceiver;
79

810
class PushoverReceiverTest extends TestCase
911
{
1012
private $pushoverReceiver;
1113

12-
public function setUp()
14+
public function setUp(): void
1315
{
1416
$this->pushoverReceiver = PushoverReceiver::withUserKey('pushover-key');
1517
}
@@ -19,23 +21,23 @@ public function it_can_set_up_a_receiver_with_an_user_key()
1921
{
2022
$pushoverReceiver = PushoverReceiver::withUserKey('pushover-key');
2123

22-
$this->assertArraySubset(['user' => 'pushover-key'], $pushoverReceiver->toArray());
24+
Assert::assertArraySubset(['user' => 'pushover-key'], $pushoverReceiver->toArray());
2325
}
2426

2527
/** @test */
2628
public function it_can_set_up_a_receiver_with_a_group_key()
2729
{
2830
$pushoverReceiver = PushoverReceiver::withGroupKey('pushover-key');
2931

30-
$this->assertArraySubset(['user' => 'pushover-key'], $pushoverReceiver->toArray());
32+
Assert::assertArraySubset(['user' => 'pushover-key'], $pushoverReceiver->toArray());
3133
}
3234

3335
/** @test */
3436
public function it_can_set_up_a_receiver_with_an_application_token()
3537
{
3638
$pushoverReceiver = PushoverReceiver::withUserKey('pushover-key')->withApplicationToken('pushover-token');
3739

38-
$this->assertArraySubset(['user' => 'pushover-key', 'token' => 'pushover-token'], $pushoverReceiver->toArray());
40+
Assert::assertArraySubset(['user' => 'pushover-key', 'token' => 'pushover-token'], $pushoverReceiver->toArray());
3941
}
4042

4143
/** @test */
@@ -53,7 +55,7 @@ public function it_can_add_a_single_device_to_the_receiver()
5355
{
5456
$this->pushoverReceiver->toDevice('iphone');
5557

56-
$this->assertArraySubset(['device' => 'iphone'], $this->pushoverReceiver->toArray());
58+
Assert::assertArraySubset(['device' => 'iphone'], $this->pushoverReceiver->toArray());
5759
}
5860

5961
/** @test */
@@ -63,14 +65,14 @@ public function it_can_add_multiple_devices_to_the_receiver()
6365
->toDevice('desktop')
6466
->toDevice('macbook');
6567

66-
$this->assertArraySubset(['device' => 'iphone,desktop,macbook'], $this->pushoverReceiver->toArray());
68+
Assert::assertArraySubset(['device' => 'iphone,desktop,macbook'], $this->pushoverReceiver->toArray());
6769
}
6870

6971
/** @test */
7072
public function it_can_add_an_array_of_devices_to_the_receiver()
7173
{
7274
$this->pushoverReceiver->toDevice(['iphone', 'desktop', 'macbook']);
7375

74-
$this->assertArraySubset(['device' => 'iphone,desktop,macbook'], $this->pushoverReceiver->toArray());
76+
Assert::assertArraySubset(['device' => 'iphone,desktop,macbook'], $this->pushoverReceiver->toArray());
7577
}
7678
}

tests/PushoverServiceProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class PushoverServiceProviderTest extends TestCase
1717
/** @var Application */
1818
protected $app;
1919

20-
public function setUp()
20+
public function setUp(): void
2121
{
2222
parent::setUp();
2323

tests/PushoverTest.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class PushoverTest extends TestCase
1919
/** @var HttpClient */
2020
protected $guzzleClient;
2121

22-
public function setUp()
22+
public function setUp(): void
2323
{
2424
parent::setUp();
2525

@@ -72,7 +72,8 @@ public function it_can_accept_parameters_for_a_send_request()
7272
/** @test */
7373
public function it_throws_an_exception_when_pushover_returns_an_error_with_invalid_json()
7474
{
75-
$this->setExpectedException(CouldNotSendNotification::class, 'Pushover responded with an error (400).');
75+
$this->expectException(CouldNotSendNotification::class);
76+
$this->expectExceptionMessage('Pushover responded with an error (400).');
7677

7778
$guzzleRequest = Mockery::mock(\Psr\Http\Message\RequestInterface::class);
7879
$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
8788
/** @test */
8889
public function it_throws_an_exception_when_pushover_returns_an_error_with_valid_json()
8990
{
90-
$this->setExpectedException(CouldNotSendNotification::class, 'Pushover responded with an error (400): error_message_1, error_message_2');
91+
$this->expectException(CouldNotSendNotification::class);
92+
$this->expectExceptionMessage('Pushover responded with an error (400): error_message_1, error_message_2');
9193

9294
$guzzleRequest = Mockery::mock(\Psr\Http\Message\RequestInterface::class);
9395
$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
102104
/** @test */
103105
public function it_throws_an_exception_when_pushover_returns_nothing()
104106
{
105-
$this->setExpectedException(ServiceCommunicationError::class, 'The communication with Pushover failed because');
107+
$this->expectException(ServiceCommunicationError::class);
108+
$this->expectExceptionMessage('The communication with Pushover failed because');
106109

107110
$guzzleRequest = Mockery::mock(\Psr\Http\Message\RequestInterface::class);
108111

@@ -114,7 +117,8 @@ public function it_throws_an_exception_when_pushover_returns_nothing()
114117
/** @test */
115118
public function it_throws_an_exception_when_an_unknown_communication_error_occurred()
116119
{
117-
$this->setExpectedException(ServiceCommunicationError::class, 'The communication with Pushover failed');
120+
$this->expectException(ServiceCommunicationError::class);
121+
$this->expectExceptionMessage('The communication with Pushover failed');
118122

119123
$this->guzzleClient->shouldReceive('post')->andThrow(new Exception);
120124

0 commit comments

Comments
 (0)