RedlinkTransport example

use Symfony\Component\Notifier\Message\ChatMessage;
use Symfony\Component\Notifier\Message\PushMessage;
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 RedlinkTransportTest extends TransportTestCase
{
    public static function createTransport(HttpClientInterface $client = null): RedlinkTransport
    {
        return (new RedlinkTransport(
            'testApiToken',
            'testAppToken',
            'TEST',
            'v2.1',
            $client ?? new MockHttpClient()
        ))->setHost('api.redlink.pl');
    }

    public static function toStringProvider(): iterable
    {
        yield ['redlink://api.redlink.pl?from=TEST&version=v2.1', self::createTransport()];
    }
throw new UnsupportedSchemeException($dsn, 'redlink', $this->getSupportedSchemes());
        }

        $apiKey = $dsn->getUser();
        $appToken = $dsn->getPassword();
        $host = 'default' === $dsn->getHost() ? null : $dsn->getHost();
        $port = $dsn->getPort();

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

        return (new RedlinkTransport($apiKey$appToken$from$version$this->client, $this->dispatcher))->setHost($host)->setPort($port);
    }

    protected function getSupportedSchemes(): array
    {
        return ['redlink'];
    }
}
Home | Imprint | This part of the site doesn't use cookies.