Skip to content

Fix tests and build #41

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

Merged
merged 5 commits into from
Jan 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ language: php
php:
- 7.2
- 7.3
- 7.4

env:
matrix:
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"pusher/pusher-php-server": "~3.0 || ~4.0"
},
"require-dev": {
"mockery/mockery": "^0.9.5",
"phpunit/phpunit": "5.*"
"mockery/mockery": "^1.3",
"phpunit/phpunit": "^8.5"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<logging>
<log type="tap" target="build/report.tap"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-html" target="build/coverage"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
Expand Down
23 changes: 8 additions & 15 deletions tests/ChannelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

namespace NotificationChannels\PusherPushNotifications\Test;

use Mockery;
use Pusher\Pusher;
use PHPUnit_Framework_TestCase;
use Illuminate\Events\Dispatcher;
use Illuminate\Notifications\Events\NotificationFailed;
use Illuminate\Notifications\Notifiable;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Events\NotificationFailed;
use Mockery;
use Mockery\Adapter\Phpunit\MockeryTestCase;
use NotificationChannels\PusherPushNotifications\PusherChannel;
use NotificationChannels\PusherPushNotifications\PusherMessage;
use Pusher\Pusher;

class ChannelTest extends PHPUnit_Framework_TestCase
class ChannelTest extends MockeryTestCase
{
public function setUp()
public function setUp(): void
{
$this->pusher = Mockery::mock(Pusher::class);

Expand All @@ -27,21 +27,14 @@ public function setUp()
$this->notifiable = new TestNotifiable;
}

public function tearDown()
{
Mockery::close();

parent::tearDown();
}

/** @test */
public function it_can_send_a_notification()
{
$message = $this->notification->toPushNotification($this->notifiable);

$data = $message->toArray();

$this->pusher->shouldReceive('notify')->with('interest_name', $data, true)->andReturn(['status' => 202]);
$this->pusher->shouldReceive('notify')->with(['interest_name'], $data, true)->andReturn(['status' => 202]);

$this->channel->send($this->notifiable, $this->notification);
}
Expand All @@ -53,7 +46,7 @@ public function it_fires_failure_event_on_failure()

$data = $message->toArray();

$this->pusher->shouldReceive('notify')->with('interest_name', $data, true)->andReturn(['status' => 500]);
$this->pusher->shouldReceive('notify')->with(['interest_name'], $data, true)->andReturn(['status' => 500]);

$this->events->shouldReceive('fire')->with(Mockery::type(NotificationFailed::class));

Expand Down
10 changes: 5 additions & 5 deletions tests/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
namespace NotificationChannels\PusherPushNotifications\Test;

use Illuminate\Support\Arr;
use PHPUnit_Framework_TestCase;
use NotificationChannels\PusherPushNotifications\PusherMessage;
use Mockery\Adapter\Phpunit\MockeryTestCase;
use NotificationChannels\PusherPushNotifications\Exceptions\CouldNotCreateMessage;
use NotificationChannels\PusherPushNotifications\PusherMessage;

class MessageTest extends PHPUnit_Framework_TestCase
class MessageTest extends MockeryTestCase
{
/** @var \NotificationChannels\PusherPushNotifications\PusherMessage */
protected $message;

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

Expand Down Expand Up @@ -111,7 +111,7 @@ public function it_can_set_the_icon()
/** @test */
public function it_will_throw_an_exception_when_an_unsupported_platform_is_used()
{
$this->setExpectedException(CouldNotCreateMessage::class);
$this->expectException(CouldNotCreateMessage::class);

$this->message->platform('bla bla');
}
Expand Down