SnsClient example


        }

        if ($dsn->getOption('region')) {
            $options['region'] = $dsn->getOption('region');
        }

        if ($dsn->getOption('profile')) {
            $options['profile'] = $dsn->getOption('profile');
        }

        return (new AmazonSnsTransport(new SnsClient($options, null, $this->client)$this->client, $this->dispatcher))->setHost($host)->setPort($port);
    }

    protected function getSupportedSchemes(): array
    {
        return ['sns'];
    }
}
use Symfony\Component\Notifier\Message\ChatMessage;
use Symfony\Component\Notifier\Message\SmsMessage;
use Symfony\Component\Notifier\Test\TransportTestCase;
use Symfony\Component\Notifier\Tests\Fixtures\TestOptions;
use Symfony\Component\Notifier\Tests\Transport\DummyMessage;
use Symfony\Contracts\HttpClient\HttpClientInterface;

class AmazonSnsTransportTest extends TransportTestCase
{
    public static function createTransport(HttpClientInterface $client = null): AmazonSnsTransport
    {
        return (new AmazonSnsTransport(new SnsClient(['region' => 'eu-west-3'])$client ?? new MockHttpClient()))->setHost('host.test');
    }

    public static function toStringProvider(): iterable
    {
        yield ['sns://host.test?region=eu-west-3', self::createTransport()];
    }

    public static function supportedMessagesProvider(): iterable
    {
        yield [new SmsMessage('0601020304', 'Hello!')];
        yield [new ChatMessage('Hello', new AmazonSnsOptions('my-topic'))];
    }
Home | Imprint | This part of the site doesn't use cookies.