Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel 5.8 support #30

Merged
merged 13 commits into from
Jun 12, 2019
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
language: php

php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3

env:
matrix:
Expand Down
13 changes: 7 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@
}
],
"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"
"mockery/mockery": "^1.0",
"phpunit/phpunit": "~8.0",
"orchestra/testbench": "~3.5|~3.6|~3.7|~3.8",
"dms/phpunit-arraysubset-asserts": ">=0.1.0"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion tests/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class IntegrationTest extends TestCase
/** @var Dispatcher */
protected $events;

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion tests/PushoverChannelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class PushoverChannelTest extends TestCase
/** @var Dispatcher */
protected $events;

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down
4 changes: 2 additions & 2 deletions tests/PushoverMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
Expand Down
16 changes: 9 additions & 7 deletions tests/PushoverReceiverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
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
{
private $pushoverReceiver;

public function setUp()
public function setUp(): void
{
$this->pushoverReceiver = PushoverReceiver::withUserKey('pushover-key');
}
Expand All @@ -19,23 +21,23 @@ 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 */
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 */
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 */
Expand All @@ -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 */
Expand All @@ -63,14 +65,14 @@ 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 */
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());
}
}
2 changes: 1 addition & 1 deletion tests/PushoverServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class PushoverServiceProviderTest extends TestCase
/** @var Application */
protected $app;

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down
14 changes: 9 additions & 5 deletions tests/PushoverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PushoverTest extends TestCase
/** @var HttpClient */
protected $guzzleClient;

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);

Expand All @@ -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);

Expand Down