MandrillHttpTransport example


        $scheme = $dsn->getScheme();
        $user = $this->getUser($dsn);
        $host = 'default' === $dsn->getHost() ? null : $dsn->getHost();
        $port = $dsn->getPort();

        if ('mandrill+api' === $scheme) {
            return (new MandrillApiTransport($user$this->client, $this->dispatcher, $this->logger))->setHost($host)->setPort($port);
        }

        if ('mandrill+https' === $scheme || 'mandrill' === $scheme) {
            return (new MandrillHttpTransport($user$this->client, $this->dispatcher, $this->logger))->setHost($host)->setPort($port);
        }

        if ('mandrill+smtp' === $scheme || 'mandrill+smtps' === $scheme) {
            $password = $this->getPassword($dsn);

            return new MandrillSmtpTransport($user$password$this->dispatcher, $this->logger);
        }

        throw new UnsupportedSchemeException($dsn, 'mandrill', $this->getSupportedSchemes());
    }

    

    public function testToString(MandrillHttpTransport $transport, string $expected)
    {
        $this->assertSame($expected(string) $transport);
    }

    public static function getTransportData()
    {
        return [
            [
                new MandrillHttpTransport('KEY'),
                'mandrill+https://mandrillapp.com',
            ],
            [
                (new MandrillHttpTransport('KEY'))->setHost('example.com'),
                'mandrill+https://example.com',
            ],
            [
                (new MandrillHttpTransport('KEY'))->setHost('example.com')->setPort(99),
                'mandrill+https://example.com:99',
            ],
        ];
    }
new Dsn('mandrill+api', 'default', self::USER),
            new MandrillApiTransport(self::USER, $client, null, $logger),
        ];

        yield [
            new Dsn('mandrill+api', 'example.com', self::USER, '', 8080),
            (new MandrillApiTransport(self::USER, $client, null, $logger))->setHost('example.com')->setPort(8080),
        ];

        yield [
            new Dsn('mandrill', 'default', self::USER),
            new MandrillHttpTransport(self::USER, $client, null, $logger),
        ];

        yield [
            new Dsn('mandrill+https', 'default', self::USER),
            new MandrillHttpTransport(self::USER, $client, null, $logger),
        ];

        yield [
            new Dsn('mandrill+https', 'example.com', self::USER, '', 8080),
            (new MandrillHttpTransport(self::USER, $client, null, $logger))->setHost('example.com')->setPort(8080),
        ];

        
Home | Imprint | This part of the site doesn't use cookies.