MailBeforeValidateEvent example

use Shopware\Core\Framework\Uuid\Uuid;

/** * @internal * * @covers \Shopware\Core\Content\MailTemplate\Service\Event\MailBeforeValidateEvent */
class MailBeforeValidateEventTest extends TestCase
{
    public function testScalarValuesCorrectly(): void
    {
        $event = new MailBeforeValidateEvent(
            ['foo' => 'bar'],
            Context::createDefaultContext(),
            ['template' => 'data'],
        );

        $storer = new ScalarValuesStorer();

        $stored = $storer->store($event[]);

        $flow = new StorableFlow('foo', Context::createDefaultContext()$stored);

        
public function getDecorated(): AbstractMailService
    {
        throw new DecorationPatternException(self::class);
    }

    /** * @param mixed[] $data * @param mixed[] $templateData */
    public function send(array $data, Context $context, array $templateData = []): ?Email
    {
        $event = new MailBeforeValidateEvent($data$context$templateData);
        $this->eventDispatcher->dispatch($event);
        $data = $event->getData();
        $templateData = $event->getTemplateData();

        if ($event->isPropagationStopped()) {
            return null;
        }

        $definition = $this->getValidationDefinition($context);
        $this->dataValidator->validate($data$definition);

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