AmazonSqsTransport example

private MockObject&ReceiverInterface $receiver;
    private MockObject&SenderInterface $sender;
    private AmazonSqsTransport $transport;

    protected function setUp(): void
    {
        $this->connection = $this->createMock(Connection::class);
        // Mocking the concrete receiver class because mocking multiple interfaces is deprecated         $this->receiver = $this->createMock(AmazonSqsReceiver::class);
        $this->sender = $this->createMock(SenderInterface::class);

        $this->transport = new AmazonSqsTransport($this->connection, null, $this->receiver, $this->sender);
    }

    public function testItIsATransport()
    {
        $transport = $this->getTransport();

        $this->assertInstanceOf(TransportInterface::class$transport);
    }

    public function testReceivesMessages()
    {
        
private ?LoggerInterface $logger;

    public function __construct(LoggerInterface $logger = null)
    {
        $this->logger = $logger;
    }

    public function createTransport(#[\SensitiveParameter] string $dsn, array $options, SerializerInterface $serializer): TransportInterface     {
        unset($options['transport_name']);

        return new AmazonSqsTransport(Connection::fromDsn($dsn$options, null, $this->logger)$serializer);
    }

    public function supports(#[\SensitiveParameter] string $dsn, array $options): bool     {
        return str_starts_with($dsn, 'sqs://') || preg_match('#^https://sqs\.[\w\-]+\.amazonaws\.com/.+#', $dsn);
    }
}
Home | Imprint | This part of the site doesn't use cookies.