Skip to content

Commit

Permalink
feat: laravel 7 support + fix name (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
atymic authored Mar 8, 2020
1 parent ff94cba commit 4842eab
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
build
composer.phar
composer.lock
.phpunit.result.cache
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Webhook notifications channel for Laravel 5.5+ and 6.0
# Webhook notifications channel for Laravel

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

This package makes it easy to send webhooks using the Laravel notification system.
This package makes it easy to send webhooks using the Laravel notification system. Supports 5.5+. 6.x and 7.x.

## Contents

Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
}
],
"require": {
"php": ">=7.0",
"php": ">=7.2.5",
"guzzlehttp/guzzle": "~6.0",
"illuminate/notifications": "~5.5 || ~6.0",
"illuminate/support": "~5.5 || ~6.0"
"illuminate/notifications": "~5.5 || ~6.0 || ~7.0",
"illuminate/support": "~5.5 || ~6.0 || ~7.0"
},
"require-dev": {
"mockery/mockery": "^0.9.5",
"phpunit/phpunit": "~7.0 || ~8.0",
"orchestra/testbench": "^3.5.0 || ^4.0",
"orchestra/database": "^3.5.0 || ^4.0"
"mockery/mockery": "^1.3",
"phpunit/phpunit": "^8.0",
"orchestra/testbench": "^3.8.0 || ^4.0 || ^5.0",
"orchestra/database": "^3.8.0 || ^4.0 | ^5.0"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions src/WebhookChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace NotificationChannels\Webhook;

use GuzzleHttp\Client;
use Illuminate\Support\Arr;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Arr;
use NotificationChannels\Webhook\Exceptions\CouldNotSendNotification;

class WebhookChannel
Expand Down Expand Up @@ -32,7 +32,7 @@ public function __construct(Client $client)
*/
public function send($notifiable, Notification $notification)
{
if (! $url = $notifiable->routeNotificationFor('Webhook')) {
if (! $url = $notifiable->routeNotificationFor('webhook')) {
return;
}

Expand Down
13 changes: 6 additions & 7 deletions tests/ChannelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace NotificationChannels\Webhook\Test;

use Mockery;
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Response;
use Orchestra\Testbench\TestCase;
use Illuminate\Notifications\Notification;
use Mockery;
use NotificationChannels\Webhook\Exceptions\CouldNotSendNotification;
use NotificationChannels\Webhook\WebhookChannel;
use NotificationChannels\Webhook\WebhookMessage;
use NotificationChannels\Webhook\Exceptions\CouldNotSendNotification;
use Orchestra\Testbench\TestCase;

class ChannelTest extends TestCase
{
Expand Down Expand Up @@ -89,16 +89,15 @@ public function it_can_send_a_notification_with_query_string()
}

/**
* @expectedException NotificationChannels\Webhook\Exceptions\CouldNotSendNotification
* @test
*/
public function it_throws_an_exception_when_it_could_not_send_the_notification()
{
$response = new Response(500);

$this->expectExceptionObject(
new CouldNotSendNotification($response, 'Webhook responded with an error: ``', 500)
);
$this->expectException(CouldNotSendNotification::class);
$this->expectExceptionMessage('Webhook responded with an error: ``');
$this->expectExceptionCode(500);

$client = Mockery::mock(Client::class);
$client->shouldReceive('post')
Expand Down
4 changes: 2 additions & 2 deletions tests/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
namespace NotificationChannels\Webhook\Test;

use Illuminate\Support\Arr;
use Orchestra\Testbench\TestCase;
use NotificationChannels\Webhook\WebhookMessage;
use Orchestra\Testbench\TestCase;

class MessageTest extends TestCase
{
/** @var \NotificationChannels\Webhook\WebhookMessage */
protected $message;

public function setUp()
public function setUp(): void
{
parent::setUp();
$this->message = new WebhookMessage();
Expand Down

0 comments on commit 4842eab

Please sign in to comment.