File: GetSuppressedDestinationResponseTest.php

package info (click to toggle)
php-async-aws-ses 1.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 320 kB
  • sloc: php: 1,658; makefile: 28
file content (38 lines) | stat: -rw-r--r-- 1,291 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php

namespace AsyncAws\Ses\Tests\Unit\Result;

use AsyncAws\Core\Response;
use AsyncAws\Core\Test\Http\SimpleMockedResponse;
use AsyncAws\Core\Test\TestCase;
use AsyncAws\Ses\Result\GetSuppressedDestinationResponse;
use Psr\Log\NullLogger;
use Symfony\Component\HttpClient\MockHttpClient;

class GetSuppressedDestinationResponseTest extends TestCase
{
    public function testGetSuppressedDestinationResponse(): void
    {
        // see https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_GetSuppressedDestination.html
        $response = new SimpleMockedResponse('{
   "SuppressedDestination": {
      "Attributes": {
         "FeedbackId": "feedback-id",
         "MessageId": "message-id"
      },
      "EmailAddress": "test@example.com",
      "LastUpdateTime": 1234567890,
      "Reason": "BOUNCE"
   }
}');

        $client = new MockHttpClient($response);
        $result = new GetSuppressedDestinationResponse(new Response($client->request('POST', 'http://localhost'), $client, new NullLogger()));

        $dest = $result->getSuppressedDestination();

        self::assertSame('test@example.com', $dest->getEmailAddress());
        self::assertSame(1234567890, $dest->getLastUpdateTime()->getTimestamp());
        self::assertSame('BOUNCE', $dest->getReason());
    }
}