getEventConfig example

$config = $message->getMailAttachmentsConfig();

        if (!$config) {
            return $this->decorated->send($message$envelope);
        }

        $attachments = $this->attachmentsBuilder->buildAttachments(
            $config->getContext(),
            $config->getMailTemplate(),
            $config->getExtension(),
            $config->getEventConfig(),
            $config->getOrderId()
        );

        foreach ($attachments as $attachment) {
            $message->attach(
                $attachment['content'],
                $attachment['fileName'],
                $attachment['mimeType']
            );
        }

        
$attachmentsConfig = new MailAttachmentsConfig(
            $context,
            $mailTemplate,
            $extension,
            $evenConfig,
            $orderId
        );

        static::assertEquals($context$attachmentsConfig->getContext());
        static::assertEquals($mailTemplate$attachmentsConfig->getMailTemplate());
        static::assertEquals($extension$attachmentsConfig->getExtension());
        static::assertEquals($evenConfig$attachmentsConfig->getEventConfig());
        static::assertEquals($orderId$attachmentsConfig->getOrderId());

        $attachmentsConfig = $this->getMockBuilder(MailAttachmentsConfig::class)
            ->disableOriginalConstructor()
            ->onlyMethods([])
            ->getMock();

        $attachmentsConfig->setContext($context);
        $attachmentsConfig->setMailTemplate($mailTemplate);
        $attachmentsConfig->setExtension($extension);
        $attachmentsConfig->setEventConfig($evenConfig);
        
$mail->setMailAttachmentsConfig($mailAttachmentsConfig);

        $this->decorated->expects(static::once())->method('send')->with($mail$envelope);

        $this->attachmentsBuilder
            ->expects(static::once())
            ->method('buildAttachments')
            ->with(
                $mailAttachmentsConfig->getContext(),
                $mailAttachmentsConfig->getMailTemplate(),
                $mailAttachmentsConfig->getExtension(),
                $mailAttachmentsConfig->getEventConfig(),
                $mailAttachmentsConfig->getOrderId()
            )
            ->willReturn([
                ['id' => 'foo', 'content' => 'foo', 'fileName' => 'bar', 'mimeType' => 'baz/asd'],
                ['id' => 'bar', 'content' => 'bar', 'fileName' => 'bar', 'mimeType' => 'baz/asd'],
            ]);

        $this->documentRepository
            ->expects(static::once())
            ->method('update')
            ->with([
                [
Home | Imprint | This part of the site doesn't use cookies.