ExpoTransport example


        $scheme = $dsn->getScheme();

        if ('expo' !== $scheme) {
            throw new UnsupportedSchemeException($dsn, 'expo', $this->getSupportedSchemes());
        }

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

        return (new ExpoTransport($token$this->client, $this->dispatcher))->setHost($host)->setPort($port);
    }

    protected function getSupportedSchemes(): array
    {
        return ['expo'];
    }
}
use Symfony\Component\Notifier\Test\TransportTestCase;
use Symfony\Component\Notifier\Tests\Transport\DummyMessage;
use Symfony\Contracts\HttpClient\HttpClientInterface;

/** * @author Imad ZAIRIG <https://github.com/zairigimad> */
final class ExpoTransportTest extends TransportTestCase
{
    public static function createTransport(HttpClientInterface $client = null): ExpoTransport
    {
        return new ExpoTransport('token', $client ?? new MockHttpClient());
    }

    public static function toStringProvider(): iterable
    {
        yield ['expo://exp.host/--/api/v2/push/send', self::createTransport()];
    }

    public static function supportedMessagesProvider(): iterable
    {
        yield [new PushMessage('Hello!', 'Symfony Notifier')];
    }

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