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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
|
<?php
namespace AsyncAws\Sns\Tests\Unit;
use AsyncAws\Core\Credentials\NullProvider;
use AsyncAws\Core\Result;
use AsyncAws\Core\Test\TestCase;
use AsyncAws\Sns\Input\CreatePlatformEndpointInput;
use AsyncAws\Sns\Input\CreateTopicInput;
use AsyncAws\Sns\Input\DeleteEndpointInput;
use AsyncAws\Sns\Input\DeleteTopicInput;
use AsyncAws\Sns\Input\ListSubscriptionsByTopicInput;
use AsyncAws\Sns\Input\ListTopicsInput;
use AsyncAws\Sns\Input\PublishBatchInput;
use AsyncAws\Sns\Input\PublishInput;
use AsyncAws\Sns\Input\SubscribeInput;
use AsyncAws\Sns\Input\UnsubscribeInput;
use AsyncAws\Sns\Result\CreateEndpointResponse;
use AsyncAws\Sns\Result\CreateTopicResponse;
use AsyncAws\Sns\Result\ListSubscriptionsByTopicResponse;
use AsyncAws\Sns\Result\ListTopicsResponse;
use AsyncAws\Sns\Result\PublishBatchResponse;
use AsyncAws\Sns\Result\PublishResponse;
use AsyncAws\Sns\Result\SubscribeResponse;
use AsyncAws\Sns\SnsClient;
use AsyncAws\Sns\ValueObject\PublishBatchRequestEntry;
use Symfony\Component\HttpClient\MockHttpClient;
class SnsClientTest extends TestCase
{
public function testCreatePlatformEndpoint(): void
{
$client = new SnsClient([], new NullProvider(), new MockHttpClient());
$input = new CreatePlatformEndpointInput([
'PlatformApplicationArn' => 'change me',
'Token' => 'change me',
]);
$result = $client->CreatePlatformEndpoint($input);
self::assertInstanceOf(CreateEndpointResponse::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testCreateTopic(): void
{
$client = new SnsClient([], new NullProvider(), new MockHttpClient());
$input = new CreateTopicInput([
'Name' => 'change me',
]);
$result = $client->CreateTopic($input);
self::assertInstanceOf(CreateTopicResponse::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testDeleteEndpoint(): void
{
$client = new SnsClient([], new NullProvider(), new MockHttpClient());
$input = new DeleteEndpointInput([
'EndpointArn' => 'change me',
]);
$result = $client->DeleteEndpoint($input);
self::assertInstanceOf(Result::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testDeleteTopic(): void
{
$client = new SnsClient([], new NullProvider(), new MockHttpClient());
$input = new DeleteTopicInput([
'TopicArn' => 'change me',
]);
$result = $client->DeleteTopic($input);
self::assertInstanceOf(Result::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testListSubscriptionsByTopic(): void
{
$client = new SnsClient([], new NullProvider(), new MockHttpClient());
$input = new ListSubscriptionsByTopicInput([
'TopicArn' => 'change me',
]);
$result = $client->ListSubscriptionsByTopic($input);
self::assertInstanceOf(ListSubscriptionsByTopicResponse::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testListTopics(): void
{
$client = new SnsClient([], new NullProvider(), new MockHttpClient());
$input = new ListTopicsInput([
]);
$result = $client->listTopics($input);
self::assertInstanceOf(ListTopicsResponse::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testPublish(): void
{
$client = new SnsClient([], new NullProvider(), new MockHttpClient());
$input = new PublishInput([
'Message' => 'change me',
]);
$result = $client->Publish($input);
self::assertInstanceOf(PublishResponse::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testPublishBatch(): void
{
$client = new SnsClient([], new NullProvider(), new MockHttpClient());
$input = new PublishBatchInput([
'TopicArn' => 'change me',
'PublishBatchRequestEntries' => [new PublishBatchRequestEntry([
'Id' => 'change me',
'Message' => 'change me',
])],
]);
$result = $client->publishBatch($input);
self::assertInstanceOf(PublishBatchResponse::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testSubscribe(): void
{
$client = new SnsClient([], new NullProvider(), new MockHttpClient());
$input = new SubscribeInput([
'TopicArn' => 'change me',
'Protocol' => 'change me',
]);
$result = $client->Subscribe($input);
self::assertInstanceOf(SubscribeResponse::class, $result);
self::assertFalse($result->info()['resolved']);
}
public function testUnsubscribe(): void
{
$client = new SnsClient([], new NullProvider(), new MockHttpClient());
$input = new UnsubscribeInput([
'SubscriptionArn' => 'change me',
]);
$result = $client->Unsubscribe($input);
self::assertInstanceOf(Result::class, $result);
self::assertFalse($result->info()['resolved']);
}
}
|