TermiiOptions example

public static function invalidFromProvider(): iterable
    {
        yield 'too short' => ['aa'];
        yield 'too long' => ['abcdefghijkl'];
        yield 'no zero at start if phone number' => ['+0'];
        yield 'phone number too short' => ['+1'];
    }

    public static function supportedMessagesProvider(): iterable
    {
        yield [new SmsMessage('0611223344', 'Hello!')];
        yield [new SmsMessage('0611223344', 'Hello!', 'from', new TermiiOptions(['from' => 'foo']))];
    }

    /** * @dataProvider invalidFromProvider */
    public function testInvalidArgumentExceptionIsThrownIfFromIsInvalid(string $from)
    {
        $transport = $this->createTransport(null, $from);

        $this->expectException(InvalidArgumentException::class);
        $this->expectExceptionMessage(sprintf('The "From" number "%s" is not a valid phone number, shortcode, or alphanumeric sender ID.', $from));

        


namespace Symfony\Component\Notifier\Bridge\Termii\Tests;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Notifier\Bridge\Termii\TermiiOptions;

class TermiiOptionsTest extends TestCase
{
    public function testTermiiOptions()
    {
        $termiiOptions = (new TermiiOptions())
            ->type('test_type')
            ->channel('test_channel')
            ->media('test_media_url', 'test_media_caption');

        self::assertSame([
            'type' => 'test_type',
            'channel' => 'test_channel',
            'media' => [
                'url' => 'test_media_url',
                'caption' => 'test_media_caption',
            ],
        ],
Home | Imprint | This part of the site doesn't use cookies.