-
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.
Merge pull request #34 from SynergiTech/goodbye-requests
♻️ refactor for postal/postal v2
- Loading branch information
Showing
8 changed files
with
194 additions
and
158 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
{ | ||
"name": "synergitech/laravel-postal", | ||
"description": "This library integrates Postal with the standard Laravel mail framework.", | ||
"keywords": [ | ||
"Laravel", | ||
"Postal", | ||
"Email" | ||
], | ||
"homepage": "https://github.com/synergitech/laravel-postal", | ||
"license": "MIT", | ||
"require": { | ||
"php": "^8.0", | ||
"laravel/framework": "^9.0.1|^10.0", | ||
"postal/postal": "^1.0.1" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^9.0", | ||
"orchestra/testbench": "^7.0|^8.0", | ||
"nunomaduro/larastan": "^2.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"SynergiTech\\Postal\\": "src", | ||
"SynergiTech\\Postal\\Tests\\": "tests" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"SynergiTech\\Postal\\PostalServiceProvider" | ||
] | ||
} | ||
}, | ||
"scripts": { | ||
"test": [ | ||
"phpunit", | ||
"phpstan --memory-limit=1G" | ||
] | ||
} | ||
} | ||
{ | ||
"name": "synergitech/laravel-postal", | ||
"description": "This library integrates Postal with the standard Laravel mail framework.", | ||
"keywords": [ | ||
"Laravel", | ||
"Postal", | ||
"Email" | ||
], | ||
"homepage": "https://github.com/synergitech/laravel-postal", | ||
"license": "MIT", | ||
"require": { | ||
"php": "^8.0", | ||
"laravel/framework": "^9.0.1|^10.0", | ||
"postal/postal": "^2.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^9.0", | ||
"orchestra/testbench": "^7.0|^8.0", | ||
"nunomaduro/larastan": "^2.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"SynergiTech\\Postal\\": "src", | ||
"SynergiTech\\Postal\\Tests\\": "tests" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"SynergiTech\\Postal\\PostalServiceProvider" | ||
] | ||
} | ||
}, | ||
"scripts": { | ||
"test": [ | ||
"phpunit", | ||
"phpstan --memory-limit=1G" | ||
] | ||
} | ||
} |
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.