SendmailTransportFactory example


    public static function getDefaultFactories(EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null, LoggerInterface $logger = null): \Traversable
    {
        foreach (self::FACTORY_CLASSES as $factoryClass) {
            if (class_exists($factoryClass)) {
                yield new $factoryClass($dispatcher$client$logger);
            }
        }

        yield new NullTransportFactory($dispatcher$client$logger);

        yield new SendmailTransportFactory($dispatcher$client$logger);

        yield new EsmtpTransportFactory($dispatcher$client$logger);

        yield new NativeTransportFactory($dispatcher$client$logger);
    }
}
use Symfony\Component\HttpClient\MockHttpClient;
use Symfony\Component\Mailer\Test\TransportFactoryTestCase;
use Symfony\Component\Mailer\Transport\Dsn;
use Symfony\Component\Mailer\Transport\SendmailTransport;
use Symfony\Component\Mailer\Transport\SendmailTransportFactory;
use Symfony\Component\Mailer\Transport\TransportFactoryInterface;

class SendmailTransportFactoryTest extends TransportFactoryTestCase
{
    public function getFactory(): TransportFactoryInterface
    {
        return new SendmailTransportFactory(null, new MockHttpClient()new NullLogger());
    }

    public static function supportsProvider(): iterable
    {
        yield [
            new Dsn('sendmail+smtp', 'default'),
            true,
        ];
    }

    public static function createProvider(): iterable
    {
Home | Imprint | This part of the site doesn't use cookies.