|
2 | 2 |
|
3 | 3 | namespace App\Test\Notification\Slack; |
4 | 4 |
|
| 5 | +use App\Notification\Client\Guzzle\GuzzleHTTPClient; |
| 6 | +use App\Notification\Client\ResponseAdapterInterface; |
5 | 7 | use App\Notification\NotificationTypeEnum; |
6 | 8 | use App\Notification\Slack\SlackNotification; |
7 | 9 | use PHPUnit\Framework\Assert; |
8 | 10 | use PHPUnit\Framework\TestCase; |
9 | 11 |
|
10 | 12 | require_once 'app/DotEnvLoader/index.php'; |
11 | 13 |
|
| 14 | +/** |
| 15 | + * @group notification |
| 16 | + */ |
12 | 17 | class SlackNotificationTest extends TestCase |
13 | 18 | { |
14 | | - /** |
15 | | - * @group notification |
16 | | - */ |
17 | | - public static function test_SlackNotification_ShouldNotify(): void |
| 19 | + public static function test_SlackNotificationInstance_ShouldAssertResponseAdapterInterfaceResponse(): void |
18 | 20 | { |
19 | | - $notification = new SlackNotification($notifyText = 'Test Notification', $messageType = NotificationTypeEnum::ERROR()); |
| 21 | + $notification = new SlackNotification( |
| 22 | + new GuzzleHTTPClient(), |
| 23 | + $notifyText = 'Test Notification', |
| 24 | + $messageType = NotificationTypeEnum::ERROR() |
| 25 | + ); |
20 | 26 | $notificationResponse = $notification->notify(); |
21 | 27 |
|
22 | | - $expectedStatusCodeOK = 200; |
23 | | - $expectedReasonPhrase = 'OK'; |
| 28 | + $expectedResponse = [ |
| 29 | + 'status_code' => 200, |
| 30 | + 'message' => 'OK', |
| 31 | + ]; |
24 | 32 |
|
25 | | - Assert::assertEquals($expectedStatusCodeOK, $notificationResponse->getStatusCode()); |
26 | | - Assert::assertEquals($expectedReasonPhrase, $notificationResponse->getReasonPhrase()); |
| 33 | + Assert::assertInstanceOf(ResponseAdapterInterface::class, $notificationResponse); |
| 34 | + Assert::assertEquals($expectedResponse, $notificationResponse->getResponse()); |
27 | 35 | } |
28 | 36 | } |
0 commit comments