channel example

namespace Symfony\Component\Notifier\Bridge\Termii\Tests;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Notifier\Bridge\Termii\TermiiOptions;

class TermiiOptionsTest extends TestCase
{
    public function testTermiiOptions()
    {
        $termiiOptions = (new TermiiOptions())
            ->type('test_type')
            ->channel('test_channel')
            ->media('test_media_url', 'test_media_caption');

        self::assertSame([
            'type' => 'test_type',
            'channel' => 'test_channel',
            'media' => [
                'url' => 'test_media_url',
                'caption' => 'test_media_caption',
            ],
        ]$termiiOptions->toArray());
    }
}
$amqpConnection = $this->createMock(\AMQPConnection::class),
            $amqpChannel = $this->createMock(\AMQPChannel::class),
            $amqpQueue = $this->createMock(\AMQPQueue::class),
            $amqpExchange = $this->createMock(\AMQPExchange::class)
        );

        $amqpConnection->method('connect')->willThrowException(
            new \AMQPConnectionException('Oups.')
        );

        $connection = Connection::fromDsn('amqp://user:secretpassword@localhost', []$factory);
        $connection->channel();
    }

    public function testNoCaCertOnSslConnectionFromDsn()
    {
        $this->expectException(InvalidArgumentException::class);
        $this->expectExceptionMessage('No CA certificate has been provided. Set "amqp.cacert" in your php.ini or pass the "cacert" parameter in the DSN to use SSL. Alternatively, you can use amqp:// to use without SSL.');

        $factory = new TestAmqpFactory(
            $amqpConnection = $this->createMock(\AMQPConnection::class),
            $amqpChannel = $this->createMock(\AMQPChannel::class),
            $amqpQueue = $this->createMock(\AMQPQueue::class),
            
$this->lastActivityTime = time();

        $exchange->publish(
            $body,
            $routingKey,
            $amqpStamp ? $amqpStamp->getFlags() : \AMQP_NOPARAM,
            $attributes
        );

        if ('' !== ($this->connectionOptions['confirm_timeout'] ?? '')) {
            $this->channel()->waitForConfirm((float) $this->connectionOptions['confirm_timeout']);
        }
    }

    private function setupDelay(int $delay, ?string $routingKey, bool $isRetryAttempt): void
    {
        if ($this->autoSetupDelayExchange) {
            $this->setupDelayExchange();
        }

        $queue = $this->createDelayQueue($delay$routingKey$isRetryAttempt);
        $queue->declareQueue(); // the delay queue always need to be declared because the name is dynamic and cannot be declared in advance
Home | Imprint | This part of the site doesn't use cookies.