ClickSendOptions example



    public static function invalidFromProvider(): iterable
    {
        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 ClickSendOptions(['custom_string' => 'test_custom_string']))];
    }

    /** * @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\ClickSend\Tests;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Notifier\Bridge\ClickSend\ClickSendOptions;

class ClickSendOptionsTest extends TestCase
{
    public function testClickSendOptions()
    {
        $clickSendOptions = (new ClickSendOptions())
            ->country('test_country')
            ->customString('test_custom_string')
            ->fromEmail('test_from_email')
            ->listId('test_list_id')
            ->schedule(999)
            ->source('test_source');

        self::assertSame([
            'country' => 'test_country',
            'custom_string' => 'test_custom_string',
            'from_email' => 'test_from_email',
            
Home | Imprint | This part of the site doesn't use cookies.