GitterTransport example

$scheme = $dsn->getScheme();

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

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

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

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

/** * @author Christin Gruber <c.gruber@touchdesign.de> */
final class GitterTransportTest extends TransportTestCase
{
    public static function createTransport(HttpClientInterface $client = null): GitterTransport
    {
        return (new GitterTransport('token', '5539a3ee5etest0d3255bfef', $client ?? new MockHttpClient()))->setHost('api.gitter.im');
    }

    public static function toStringProvider(): iterable
    {
        yield ['gitter://api.gitter.im?room_id=5539a3ee5etest0d3255bfef', self::createTransport()];
    }

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

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