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
declare(strict_types=1);
namespace AsyncAws\Sqs\Tests\Unit\Result;
use AsyncAws\Core\Response;
use AsyncAws\Core\Test\Http\SimpleMockedResponse;
use AsyncAws\Sqs\Result\CreateQueueResult;
use PHPUnit\Framework\TestCase;
use Psr\Log\NullLogger;
use Symfony\Component\HttpClient\MockHttpClient;
class CreateQueueResultTest extends TestCase
{
public function testCreateQueueResult()
{
// see https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_CreateQueue.html
$response = new SimpleMockedResponse(<<<JSON
{
"QueueUrl":"https://queue.amazonaws.com/123456789012/MyQueue"
}
JSON
);
$client = new MockHttpClient($response);
$result = new CreateQueueResult(new Response($client->request('POST', 'http://localhost'), $client, new NullLogger()));
self::assertEquals('https://queue.amazonaws.com/123456789012/MyQueue', $result->getQueueUrl());
}
}
|