FirebaseTransport example


        $scheme = $dsn->getScheme();

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

        $token = sprintf('%s:%s', $this->getUser($dsn)$this->getPassword($dsn));
        $host = 'default' === $dsn->getHost() ? null : $dsn->getHost();
        $port = $dsn->getPort();

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

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

/** * @author Oskar Stark <oskarstark@googlemail.com> */
final class FirebaseTransportTest extends TransportTestCase
{
    public static function createTransport(HttpClientInterface $client = null): FirebaseTransport
    {
        return new FirebaseTransport('username:password', $client ?? new MockHttpClient());
    }

    public static function toStringProvider(): iterable
    {
        yield ['firebase://fcm.googleapis.com/fcm/send', self::createTransport()];
    }

    public static function supportedMessagesProvider(): iterable
    {
        yield [new ChatMessage('Hello!')];
    }

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