File: CreateTopicResponseTest.php

package info (click to toggle)
php-async-aws-sns 1.11.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 516 kB
  • sloc: php: 2,567; makefile: 33
file content (31 lines) | stat: -rw-r--r-- 1,133 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
27
28
29
30
31
<?php

namespace AsyncAws\Sns\Tests\Unit\Result;

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

class CreateTopicResponseTest extends TestCase
{
    public function testCreateTopicResponse(): void
    {
        // see https://docs.aws.amazon.com/sns/latest/api/API_CreateTopic.html
        $response = new SimpleMockedResponse('<CreateTopicResponse xmlns="https://sns.amazonaws.com/doc/2010-03-31/">
    <CreateTopicResult>
        <TopicArn>arn:aws:sns:us-east-2:123456789012:My-Topic</TopicArn>
    </CreateTopicResult>
    <ResponseMetadata>
        <RequestId>a8dec8b3-33a4-11df-8963-01868b7c937a</RequestId>
    </ResponseMetadata>
</CreateTopicResponse>');

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

        self::assertSame('arn:aws:sns:us-east-2:123456789012:My-Topic', $result->getTopicArn());
    }
}