Skip to content

Commit

Permalink
feat: laravel 7 + test fixes (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
atymic committed Apr 26, 2020
1 parent f8d307d commit 46f3320
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 23 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
@@ -1,10 +1,9 @@
language: php

php:
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4

env:
matrix:
Expand All @@ -16,7 +15,7 @@ before_script:
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source

script:
- phpunit --coverage-text --coverage-clover=coverage.clover
- ./vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover

after_script:
- wget https://scrutinizer-ci.com/ocular.phar
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -9,7 +9,7 @@
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/laravel-notification-channels/jusibe/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/laravel-notification-channels/jusibe/?branch=master)
[![Total Downloads](https://img.shields.io/packagist/dt/laravel-notification-channels/jusibe.svg?style=flat-square)](https://packagist.org/packages/laravel-notification-channels/jusibe)

This package makes it easy to send [Jusibe notifications](https://jusibe.com/docs/) with Laravel 5.5+ and 6.x.
This package makes it easy to send [Jusibe notifications](https://jusibe.com/docs/) with Laravel 5.5+, 6.x, & 7.x.

## Contents

Expand Down
10 changes: 5 additions & 5 deletions composer.json
Expand Up @@ -12,15 +12,15 @@
}
],
"require": {
"php": ">=7.0",
"php": ">=7.2",
"unicodeveloper/jusibe-php-lib": "1.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": "^1.0",
"orchestra/testbench": "^4.3",
"phpunit/phpunit": "8.*",
"orchestra/testbench": "^4.3 || ~5.1",
"phpunit/phpunit": "8.* || 9.*",
"guzzlehttp/guzzle": "~6.0"
},
"autoload": {
Expand Down
1 change: 0 additions & 1 deletion phpunit.xml.dist
Expand Up @@ -20,7 +20,6 @@
</whitelist>
</filter>
<logging>
<log type="tap" target="build/report.tap"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage" />
<log type="coverage-text" target="build/coverage.txt"/>
Expand Down
Empty file removed tests/Helper.php
Empty file.
19 changes: 9 additions & 10 deletions tests/JusibeChannelTest.php
Expand Up @@ -2,13 +2,13 @@

namespace NotificationChannels\Jusibe\Test;

use Mockery;
use Illuminate\Notifications\Notification;
use Orchestra\Testbench\TestCase;
use Mockery;
use NotificationChannels\Jusibe\Exceptions\CouldNotSendNotification;
use NotificationChannels\Jusibe\JusibeChannel;
use NotificationChannels\Jusibe\JusibeMessage;
use Orchestra\Testbench\TestCase;
use Unicodeveloper\Jusibe\Jusibe as JusibeClient;
use NotificationChannels\Jusibe\Exceptions\CouldNotSendNotification;

class JusibeChannelTest extends TestCase
{
Expand All @@ -24,7 +24,7 @@ class JusibeChannelTest extends TestCase
/** @var JusibeMessage */
protected $message;

public function setUp()
public function setUp(): void
{
parent::setUp();
$this->jusibe = Mockery::mock(JusibeClient::class);
Expand All @@ -33,7 +33,7 @@ public function setUp()
$this->message = Mockery::mock(JusibeMessage::class);
}

public function tearDown()
public function tearDown(): void
{
Mockery::close();
parent::tearDown();
Expand All @@ -49,23 +49,22 @@ public function it_can_send_a_notification()
->with($notifiable)
->andReturn($this->message);


$this->jusibe->shouldReceive('sendSMS')
->with(Mockery::subset([
'to' => '+1234567890',
'from' => 'prosper',
'message' => 'myMessage',
]));

$this->setExpectedException(CouldNotSendNotification::class);
$this->expectException(CouldNotSendNotification::class);
$this->channel->send($notifiable, $this->notification);
}

/** @test */
public function it_does_not_send_a_message_when_notifiable_does_not_have_route_notificaton_for_jusibe()
{
$this->notification->shouldReceive('toJusibe')->never();
$this->setExpectedException(CouldNotSendNotification::class);
$this->expectException(CouldNotSendNotification::class);
$this->channel->send(new NotifiableWithoutRouteNotificationForJusibe, $this->notification);
}

Expand All @@ -84,14 +83,14 @@ public function it_throws_an_exception_when_it_could_not_send_the_notification()
'from' => 'prosper',
'message' => 'myMessage',
]));
$this->setExpectedException(CouldNotSendNotification::class);
$this->expectException(CouldNotSendNotification::class);
$this->channel->send($notifiable, $this->notification);
}
}

class NotifiableWithoutRouteNotificationForJusibe extends Notifiable
{
public function routeNotificationFor($channel)
public function routeNotificationFor($driver, $notification = null)
{
return false;
}
Expand Down
6 changes: 3 additions & 3 deletions tests/JusibeMessageTest.php
Expand Up @@ -3,14 +3,14 @@
namespace NotificationChannels\Jusibe\Test;

use NotificationChannels\Jusibe\JusibeMessage;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;

class JusibeMessageTest extends PHPUnit_Framework_TestCase
class JusibeMessageTest extends TestCase
{
/** @var \NotificationChannels\Jusibe\JusibeMessage */
protected $message;

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

Expand Down

0 comments on commit 46f3320

Please sign in to comment.