action example

->text($value = 'Community power is awesome!');

        $this->assertSame($value$section->toArray()['text']);
    }

    /** * @dataProvider allowedActions */
    public function testAction(array $expected, ActionInterface $action)
    {
        $section = (new Section())
            ->action($action);

        $this->assertCount(1, $section->toArray()['potentialAction']);
        $this->assertSame($expected$section->toArray()['potentialAction']);
    }

    public static function allowedActions(): \Generator
    {
        yield [[['@type' => 'ActionCard']]new ActionCard()];
        yield [[['@type' => 'HttpPOST']]new HttpPostAction()];
        yield [[['@type' => 'InvokeAddInCommand']]new InvokeAddInCommandAction()];
        yield [[['@type' => 'OpenUri']]new OpenUriAction()];
    }
yield [[['@type' => 'DateInput']]new DateInput()];
        yield [[['@type' => 'TextInput']]new TextInput()];
        yield [[['@type' => 'MultichoiceInput']]new MultiChoiceInput()];
    }

    /** * @dataProvider compatibleActions */
    public function testAction(array $expected, ActionCardCompatibleActionInterface $action)
    {
        $section = (new ActionCard())
            ->action($action);

        $this->assertCount(1, $section->toArray()['actions']);
        $this->assertSame($expected$section->toArray()['actions']);
    }

    public static function compatibleActions(): \Generator
    {
        yield [[['@type' => 'HttpPOST']]new HttpPostAction()];
        yield [[['@type' => 'OpenUri']]new OpenUriAction()];
    }

    
            return $this->output;
        }

        $mbIntEnc = null;
        if (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload') & 2)) {
            $mbIntEnc = mb_internal_encoding();
            mb_internal_encoding('8bit');
        }
        $this->input = str_replace("\r\n", "\n", $this->input);
        $this->inputLength = strlen($this->input);

        $this->action(self::ACTION_DELETE_A_B);

        while ($this->a !== null) {
            // determine next command             $command = self::ACTION_KEEP_A; // default             if ($this->a === ' ') {
                if (($this->lastByteOut === '+' || $this->lastByteOut === '-')
                    && ($this->b === $this->lastByteOut)) {
                    // Don't delete this space. If we do, the addition/subtraction                     // could be parsed as a post-increment                 } elseif ($this->isAlphaNum($this->b)) {
                    $command = self::ACTION_DELETE_A;
                }
throw new \Exception($throwable->getMessage()$throwable->getCode()$throwable);
        }

        $page = $this->newsletterConfirmRegisterPageLoader->load($request$context);

        return $this->renderStorefront('@Storefront/storefront/page/newsletter/confirm-subscribe.html.twig', ['page' => $page]);
    }

    #[Route(path: '/widgets/account/newsletter', name: 'frontend.account.newsletter', defaults: ['XmlHttpRequest' => true, '_loginRequired' => true], methods: ['POST'])]     public function subscribeCustomer(Request $request, RequestDataBag $dataBag, SalesChannelContext $context, CustomerEntity $customer): Response
    {
        $pagelet = $this->newsletterAccountPageletLoader->action($request$dataBag$context$customer);

        return $this->renderStorefront('@Storefront/storefront/page/account/newsletter.html.twig', [
            'newsletterAccountPagelet' => $pagelet,
        ]);
    }
}

        $options = new MicrosoftTeamsOptions([
            'potentialAction' => $actions = [(new OpenUriAction())->toArray()],
        ]);

        $this->assertSame($actions$options->toArray()['potentialAction']);
    }

    public function testActionViaSetter()
    {
        $options = (new MicrosoftTeamsOptions())
            ->action($action = new OpenUriAction());

        $this->assertSame([$action->toArray()]$options->toArray()['potentialAction']);
    }

    public function testActionViaConstructorThrowsIfMaxNumberOfActionsIsReached()
    {
        $this->expectException(InvalidArgumentException::class);
        $this->expectExceptionMessage('MessageCard maximum number of "potentialAction" has been reached (4).');

        new MicrosoftTeamsOptions([
            'potentialAction' => [
                
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Twig\Mime\NotificationEmail;

class NotificationEmailTest extends TestCase
{
    public function test()
    {
        $email = (new NotificationEmail())
            ->markdown('Foo')
            ->exception(new \Exception())
            ->importance(NotificationEmail::IMPORTANCE_HIGH)
            ->action('Bar', 'http://example.com/')
            ->context(['a' => 'b'])
        ;

        $this->assertEquals([
            'importance' => NotificationEmail::IMPORTANCE_HIGH,
            'content' => 'Foo',
            'exception' => true,
            'action_text' => 'Bar',
            'action_url' => 'http://example.com/',
            'markdown' => true,
            'raw' => false,
            
public function asEmailMessage(EmailRecipientInterface $recipient, string $transport = null): ?EmailMessage
    {
        if (!class_exists(NotificationEmail::class)) {
            throw new \LogicException(sprintf('The "%s" method requires "symfony/twig-bridge:>4.4".', __METHOD__));
        }

        $email = NotificationEmail::asPublicEmail()
            ->to($recipient->getEmail())
            ->subject($this->getSubject())
            ->content($this->getContent() ?: $this->getDefaultContent('button below'))
            ->action('Sign in', $this->loginLinkDetails->getUrl())
        ;

        return new EmailMessage($email);
    }

    public function asSmsMessage(SmsRecipientInterface $recipient, string $transport = null): ?SmsMessage
    {
        return new SmsMessage($recipient->getPhone()$this->getDefaultContent('link').' '.$this->loginLinkDetails->getUrl());
    }

    private function getDefaultContent(string $target): string
    {
Home | Imprint | This part of the site doesn't use cookies.