-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc5c219
commit 6eff73c
Showing
7 changed files
with
154 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ | |
use Illuminate\Support\Facades\Mail; | ||
use Illuminate\Support\Facades\Notification; | ||
use Postal\Client; | ||
use Postal\Send\Result; | ||
use Postal\SendService; | ||
use Symfony\Component\Mailer\DelayedEnvelope; | ||
use SynergiTech\Postal\PostalNotificationChannel; | ||
use SynergiTech\Postal\PostalTransport; | ||
|
@@ -13,19 +15,23 @@ class FeatureTest extends TestCase | |
{ | ||
public function testSendingNotificationOnDemand() | ||
{ | ||
$result = new \stdClass; | ||
$result->message_id = 'feature-test'; | ||
$message = new \stdClass(); | ||
$message->id = 'feature-test'; | ||
$message->token = 'feature-test'; | ||
$result->messages['[email protected]'] = $message; | ||
|
||
$clientMock = $this->createMock(Client::class); | ||
$clientMock | ||
->method('makeRequest') | ||
->willReturn($result); | ||
|
||
Mail::extend('postal', function (array $config = []) use ($clientMock) { | ||
Mail::extend('postal', function (array $config = []) { | ||
$clientMock = $this->createMock(Client::class); | ||
$serviceMock = $this->createMock(SendService::class); | ||
|
||
$result = new Result([ | ||
'message_id' => 'feature-test', | ||
'messages' => ['[email protected]' => [ | ||
'id' => 123, | ||
'token' => 'feature-test', | ||
]], | ||
]); | ||
|
||
$serviceMock->method('message') | ||
->willReturn($result); | ||
|
||
$clientMock->send = $serviceMock; | ||
|
||
return new PostalTransport($clientMock); | ||
}); | ||
|
||
|
@@ -48,19 +54,23 @@ public function testSendingNotificationOnDemand() | |
|
||
public function testSendingNotificationOnDemandWithAlias() | ||
{ | ||
$result = new \stdClass; | ||
$result->message_id = 'feature-test'; | ||
$message = new \stdClass(); | ||
$message->id = 'feature-test'; | ||
$message->token = 'feature-test'; | ||
$result->messages['[email protected]'] = $message; | ||
|
||
$clientMock = $this->createMock(Client::class); | ||
$clientMock | ||
->method('makeRequest') | ||
->willReturn($result); | ||
|
||
Mail::extend('postal', function (array $config = []) use ($clientMock) { | ||
Mail::extend('postal', function (array $config = []) { | ||
$clientMock = $this->createMock(Client::class); | ||
$serviceMock = $this->createMock(SendService::class); | ||
|
||
$result = new Result([ | ||
'message_id' => 'feature-test', | ||
'messages' => ['[email protected]' => [ | ||
'id' => 123, | ||
'token' => 'feature-test', | ||
]], | ||
]); | ||
|
||
$serviceMock->method('message') | ||
->willReturn($result); | ||
|
||
$clientMock->send = $serviceMock; | ||
|
||
return new PostalTransport($clientMock); | ||
}); | ||
|
||
|
@@ -83,19 +93,23 @@ public function testSendingNotificationOnDemandWithAlias() | |
|
||
public function testSendingNotificationWithNotifiableTrait() | ||
{ | ||
$result = new \stdClass; | ||
$result->message_id = 'feature-test'; | ||
$message = new \stdClass(); | ||
$message->id = 'feature-test'; | ||
$message->token = 'feature-test'; | ||
$result->messages['[email protected]'] = $message; | ||
|
||
$clientMock = $this->createMock(Client::class); | ||
$clientMock | ||
->method('makeRequest') | ||
->willReturn($result); | ||
|
||
Mail::extend('postal', function (array $config = []) use ($clientMock) { | ||
Mail::extend('postal', function (array $config = []) { | ||
$clientMock = $this->createMock(Client::class); | ||
$serviceMock = $this->createMock(SendService::class); | ||
|
||
$result = new Result([ | ||
'message_id' => 'feature-test', | ||
'messages' => ['[email protected]' => [ | ||
'id' => 123, | ||
'token' => 'feature-test', | ||
]], | ||
]); | ||
|
||
$serviceMock->method('message') | ||
->willReturn($result); | ||
|
||
$clientMock->send = $serviceMock; | ||
|
||
return new PostalTransport($clientMock); | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.