FakeSmsLoggerTransport example

$to = $dsn->getRequiredOption('to');
            $from = $dsn->getRequiredOption('from');

            return (new FakeSmsEmailTransport($this->mailer, $to$from))->setHost($mailerTransport);
        }

        if ('fakesms+logger' === $scheme) {
            if (null === $this->logger) {
                $this->throwMissingDependencyException($scheme, LoggerInterface::class, 'psr/log');
            }

            return new FakeSmsLoggerTransport($this->logger);
        }

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

    protected function getSupportedSchemes(): array
    {
        return ['fakesms+email', 'fakesms+logger'];
    }

    private function throwMissingDependencyException(string $scheme, string $missingDependency, string $suggestedPackage): void
    {
use Symfony\Component\Notifier\Bridge\FakeSms\FakeSmsLoggerTransport;
use Symfony\Component\Notifier\Message\ChatMessage;
use Symfony\Component\Notifier\Message\SmsMessage;
use Symfony\Component\Notifier\Test\TransportTestCase;
use Symfony\Component\Notifier\Tests\Transport\DummyMessage;
use Symfony\Contracts\HttpClient\HttpClientInterface;

final class FakeSmsLoggerTransportTest extends TransportTestCase
{
    public static function createTransport(HttpClientInterface $client = null, LoggerInterface $logger = null): FakeSmsLoggerTransport
    {
        $transport = (new FakeSmsLoggerTransport($logger ?? new NullLogger()$client ?? new MockHttpClient()));

        return $transport;
    }

    public static function toStringProvider(): iterable
    {
        yield ['fakesms+logger://default', self::createTransport()];
    }

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