externalId example

public static function toStringProvider(): iterable
    {
        yield ['redlink://api.redlink.pl?from=TEST&version=v2.1', self::createTransport()];
    }

    public static function supportedMessagesProvider(): iterable
    {
        yield [new SmsMessage('+48123123123', 'Summary')];
        yield [new SmsMessage('+48123123123', 'Summary', '')];
        yield [new SmsMessage('+48123123123', 'Summary', 'customSender')];
        yield [new SmsMessage('+48123123123', 'Summary', '', (new RedlinkOptions())->externalId('aaa-aaa-aaa'))];
    }

    public static function unsupportedMessagesProvider(): iterable
    {
        yield [new PushMessage('Hi!', 'Hello!')];
        yield [new ChatMessage('Hello!')];
        yield [new DummyMessage()];
    }
}
final class OneSignalOptionsTest extends TestCase
{
    public function testOneSignalOptions()
    {
        $oneSignalOptions = (new OneSignalOptions())
            ->headings(['en' => 'English Heading', 'fr' => 'French Heading'])
            ->contents(['en' => 'English Content', 'fr' => 'French Content'])
            ->url('https://example.com')
            ->data(['foo' => 'bar'])
            ->sendAfter(new \DateTimeImmutable('Thu Sep 24 2015 14:00:00 GMT-0700 (PDT)'))
            ->externalId('d637f30d-f709-4bed-9e2c-63637cb91894');

        $this->assertSame([
            'headings' => ['en' => 'English Heading', 'fr' => 'French Heading'],
            'contents' => ['en' => 'English Content', 'fr' => 'French Content'],
            'url' => 'https://example.com',
            'data' => ['foo' => 'bar'],
            'send_after' => '2015-09-24 14:00:00-0700',
            'external_id' => 'd637f30d-f709-4bed-9e2c-63637cb91894',
        ]$oneSignalOptions->toArray());
    }
}
Home | Imprint | This part of the site doesn't use cookies.