Skip to content

Commit fd71b25

Browse files
authored
feat: support laravel 6 (#3)
feat: support laravel 6
2 parents 45ed4a1 + 0579ad0 commit fd71b25

File tree

7 files changed

+32
-27
lines changed

7 files changed

+32
-27
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
build
33
composer.phar
44
composer.lock
5+
.phpunit.result.cache

.styleci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
preset: laravel
2-
3-
linting: true

.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:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PagerDuty Event notifications channel for Laravel 5.3
1+
# PagerDuty Event notifications channel for Laravel
22

33
[![Latest Version on Packagist](https://img.shields.io/packagist/v/laravel-notification-channels/pagerduty.svg?style=flat-square)](https://packagist.org/packages/laravel-notification-channels/pagerduty)
44
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
@@ -9,7 +9,7 @@
99
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/laravel-notification-channels/pagerduty/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/laravel-notification-channels/pagerduty/?branch=master)
1010
[![Total Downloads](https://img.shields.io/packagist/dt/laravel-notification-channels/pagerduty.svg?style=flat-square)](https://packagist.org/packages/laravel-notification-channels/pagerduty)
1111

12-
This package makes it easy to send notification events to [PagerDuty](https://www.pagerduty.com) with Laravel 5.3.
12+
This package makes it easy to send notification events to [PagerDuty](https://www.pagerduty.com) with Laravel 5.5+ & 6.x.
1313

1414
## Contents
1515

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
}
1414
],
1515
"require": {
16-
"php": ">=5.6.4",
16+
"php": ">=7.1",
1717
"guzzlehttp/guzzle": "~6.0",
18-
"illuminate/notifications": "^5.3",
19-
"illuminate/support": "^5.1|^5.2|^5.3"
18+
"illuminate/notifications": "~5.5 || ~6.0",
19+
"illuminate/support": "~5.5 || ~6.0"
2020
},
2121
"require-dev": {
22-
"illuminate/queue": "^5.1|^5.2|^5.3",
23-
"mockery/mockery": "^0.9.9",
24-
"phpunit/phpunit": "^5.7"
22+
"illuminate/queue": "~5.5 || ~6.0",
23+
"mockery/mockery": "^1.2",
24+
"phpunit/phpunit": "^8.0"
2525
},
2626
"autoload": {
2727
"psr-4": {

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<logging>
2323
<log type="tap" target="build/report.tap"/>
2424
<log type="junit" target="build/report.junit.xml"/>
25-
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
25+
<log type="coverage-html" target="build/coverage"/>
2626
<log type="coverage-text" target="build/coverage.txt"/>
2727
<log type="coverage-clover" target="build/logs/clover.xml"/>
2828
</logging>

tests/PagerDutyChannelTest.php

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@
22

33
namespace NotificationChannels\PagerDuty\Test;
44

5-
use Mockery;
65
use GuzzleHttp\Client;
76
use GuzzleHttp\Psr7\Response;
8-
use PHPUnit\Framework\TestCase;
97
use Illuminate\Notifications\Notification;
8+
use Mockery;
109
use NotificationChannels\PagerDuty\PagerDutyChannel;
1110
use NotificationChannels\PagerDuty\PagerDutyMessage;
11+
use PHPUnit\Framework\TestCase;
1212

1313
class ChannelTest extends TestCase
1414
{
15-
public function tearDown()
15+
public function tearDown(): void
1616
{
17+
$this->addToAssertionCount(
18+
\Mockery::getContainer()->mockery_getExpectationCount()
19+
);
1720
Mockery::close();
1821
}
1922

@@ -44,11 +47,12 @@ public function it_skips_when_not_routable()
4447

4548
/**
4649
* @test
47-
* @expectedException \NotificationChannels\PagerDuty\Exceptions\ApiError
48-
* @expectedExceptionMessage PagerDuty returned 400 Bad Request: Event object is invalid - Length of 'routing_key' is incorrect (should be 32 characters)
4950
*/
5051
public function it_throws_an_exception_when_400_bad_request()
5152
{
53+
$this->expectException('\NotificationChannels\PagerDuty\Exceptions\ApiError');
54+
$this->expectExceptionMessage('PagerDuty returned 400 Bad Request: Event object is invalid - Length of \'routing_key\' is incorrect (should be 32 characters)');
55+
5256
$responseBody = '{
5357
"status": "invalid event",
5458
"message": "Event object is invalid",
@@ -68,11 +72,12 @@ public function it_throws_an_exception_when_400_bad_request()
6872

6973
/**
7074
* @test
71-
* @expectedException \NotificationChannels\PagerDuty\Exceptions\ApiError
72-
* @expectedExceptionMessage PagerDuty returned 400 Bad Request: -
7375
*/
7476
public function it_throws_the_expected_exception_if_error_response_doesnt_contain_expected_body_on_error()
7577
{
78+
$this->expectException('\NotificationChannels\PagerDuty\Exceptions\ApiError');
79+
$this->expectExceptionMessage('PagerDuty returned 400 Bad Request: -');
80+
7681
$response = new Response(400, [], '', '1.1', 'Bad Request');
7782
$client = Mockery::mock(Client::class);
7883
$client->shouldReceive('post')
@@ -84,11 +89,12 @@ public function it_throws_the_expected_exception_if_error_response_doesnt_contai
8489

8590
/**
8691
* @test
87-
* @expectedException \NotificationChannels\PagerDuty\Exceptions\ApiError
88-
* @expectedExceptionMessage PagerDuty returned 429 Too Many Requests
8992
*/
9093
public function it_throws_exception_on_rate_limit()
9194
{
95+
$this->expectException('\NotificationChannels\PagerDuty\Exceptions\ApiError');
96+
$this->expectExceptionMessage('PagerDuty returned 429 Too Many Requests');
97+
9298
$response = new Response(429, [], '', '1.1', 'Too Many Requests');
9399
$client = Mockery::mock(Client::class);
94100
$client->shouldReceive('post')
@@ -100,11 +106,12 @@ public function it_throws_exception_on_rate_limit()
100106

101107
/**
102108
* @test
103-
* @expectedException \NotificationChannels\PagerDuty\Exceptions\ApiError
104-
* @expectedExceptionMessage PagerDuty responded with an unexpected HTTP Status: 503
105109
*/
106110
public function it_throws_exception_on_unexpected_code()
107111
{
112+
$this->expectException('\NotificationChannels\PagerDuty\Exceptions\ApiError');
113+
$this->expectExceptionMessage('PagerDuty responded with an unexpected HTTP Status: 503');
114+
108115
$response = new Response(503, [], '', '1.1', 'Service Unavailable');
109116
$client = Mockery::mock(Client::class);
110117
$client->shouldReceive('post')
@@ -116,11 +123,11 @@ public function it_throws_exception_on_unexpected_code()
116123

117124
/**
118125
* @test
119-
* @expectedException \NotificationChannels\PagerDuty\Exceptions\CouldNotSendNotification
120-
* @expectedExceptionMessage Cannot send message to PagerDuty: Test Exception
121126
*/
122127
public function it_rethrows_exception_on_client_exception()
123128
{
129+
$this->expectException('\NotificationChannels\PagerDuty\Exceptions\CouldNotSendNotification');
130+
$this->expectExceptionMessage('Cannot send message to PagerDuty: Test Exception');
124131
$e = new \Exception('Test Exception');
125132

126133
$client = Mockery::mock(Client::class);

0 commit comments

Comments
 (0)