File: SendEmailResponseTest.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 (26 lines) | stat: -rw-r--r-- 871 bytes parent folder | download | duplicates (3)
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
<?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\SendEmailResponse;
use Psr\Log\NullLogger;
use Symfony\Component\HttpClient\MockHttpClient;

class SendEmailResponseTest extends TestCase
{
    public function testSendEmailResponse(): void
    {
        // see example-1.json from SDK
        $response = new SimpleMockedResponse('{
            "MessageId": "EXAMPLE78603177f-7a5433e7-8edb-42ae-af10-f0181f34d6ee-000000"
        }');

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

        self::assertSame('EXAMPLE78603177f-7a5433e7-8edb-42ae-af10-f0181f34d6ee-000000', $result->getMessageId());
    }
}