recipient example

$smtp_from = $this->Sender;
        }
        if (!$this->smtp->mail($smtp_from)) {
            $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError()));
            throw new Exception($this->ErrorInfo, self::STOP_CRITICAL);
        }

        $callbacks = [];
        //Attempt to send to all recipients         foreach ([$this->to, $this->cc, $this->bcc] as $togroup) {
            foreach ($togroup as $to) {
                if (!$this->smtp->recipient($to[0]$this->dsn)) {
                    $error = $this->smtp->getError();
                    $bad_rcpt[] = ['to' => $to[0], 'error' => $error['detail']];
                    $isSent = false;
                } else {
                    $isSent = true;
                }

                $callbacks[] = ['issent' => $isSent, 'to' => $to[0], 'name' => $to[1]];
            }
        }

        

        $options = new MicrosoftTeamsOptions([
            'recipient_id' => $recipient = '/webhookb2/foo',
        ]);

        $this->assertSame($recipient$options->getRecipientId());
    }

    public function testGetRecipientIdReturnsRecipientWhenSetSetter()
    {
        $options = (new MicrosoftTeamsOptions())
            ->recipient($recipient = '/webhookb2/foo');

        $this->assertSame($recipient$options->getRecipientId());
    }

    public function testGetRecipientIdReturnsNullIfNotSetViaConstructorAndSetter()
    {
        $options = new MicrosoftTeamsOptions();

        $this->assertNull($options->getRecipientId());
    }

    


    public static function toStringProvider(): iterable
    {
        yield ['onesignal://9fb175f0-0b32-4e99-ae97-bd228b9eb246@onesignal.com', self::createTransport()];
        yield ['onesignal://9fb175f0-0b32-4e99-ae97-bd228b9eb246@onesignal.com?recipientId=ea345989-d273-4f21-a33b-0c006efc5edb', self::createTransport(null, 'ea345989-d273-4f21-a33b-0c006efc5edb')];
    }

    public static function supportedMessagesProvider(): iterable
    {
        yield [new PushMessage('Hello', 'World'), self::createTransport(null, 'ea345989-d273-4f21-a33b-0c006efc5edb')];
        yield [new PushMessage('Hello', 'World', (new OneSignalOptions())->recipient('ea345989-d273-4f21-a33b-0c006efc5edb'))];
    }

    public static function unsupportedMessagesProvider(): iterable
    {
        yield [new SmsMessage('0611223344', 'Hello!')];
        yield [new ChatMessage('Hello!')];
        yield [new DummyMessage()];
    }

    public function testSendThrowsWithoutRecipient()
    {
        

    public function testGetRecipientId(?string $expected, SlackOptions $options)
    {
        $this->assertSame($expected$options->getRecipientId());
    }

    public static function getRecipientIdProvider(): iterable
    {
        yield [null, new SlackOptions()];
        yield [null, new SlackOptions(['recipient_id' => null])];
        yield ['foo', (new SlackOptions())->recipient('foo')];
        yield ['foo', new SlackOptions(['recipient_id' => 'foo'])];
    }

    /** * @dataProvider setProvider * * @param mixed $value */
    public function testSet(string $method, string $optionsKey$value)
    {
        $options = (new SlackOptions())->$method($value);

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