EngagespotTransport example

$scheme = $dsn->getScheme();

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

        $apiKey = $dsn->getUser();
        $campaignName = $dsn->getRequiredOption('campaign_name');
        $host = 'default' === $dsn->getHost() ? null : $dsn->getHost();
        $port = $dsn->getPort();

        return (new EngagespotTransport($apiKey$campaignName$this->client, $this->dispatcher))->setHost($host)->setPort($port);
    }

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

/** * @author Daniel GORGAN <https://github.com/danut007ro> */
final class EngagespotTransportTest extends TransportTestCase
{
    public static function createTransport(HttpClientInterface $client = null): EngagespotTransport
    {
        return new EngagespotTransport('apiKey', 'TEST', $client ?? new MockHttpClient());
    }

    public static function toStringProvider(): iterable
    {
        yield ['engagespot://api.engagespot.co/2/campaigns?campaign_name=TEST', self::createTransport()];
    }

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

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