MailService example


    private LoggerInterface $logger;

    protected function setUp(): void
    {
        $this->mailFactory = $this->createMock(AbstractMailFactory::class);
        $this->eventDispatcher = $this->createMock(EventDispatcherInterface::class);
        $this->templateRenderer = $this->createMock(StringTemplateRenderer::class);
        $this->salesChannelRepository = $this->createMock(EntityRepository::class);
        $this->logger = $this->createMock(LoggerInterface::class);

        $this->mailService = new MailService(
            $this->createMock(DataValidator::class),
            $this->templateRenderer,
            $this->mailFactory,
            $this->createMock(AbstractMailSender::class),
            $this->createMock(EntityRepository::class),
            $this->createMock(SalesChannelDefinition::class),
            $this->salesChannelRepository,
            $this->createMock(SystemConfigService::class),
            $this->eventDispatcher,
            $this->createMock(UrlGeneratorInterface::class),
            $this->logger,
        );

    use IntegrationTestBehaviour;
    use SalesChannelApiTestBehaviour;

    public function testPluginsCanExtendMailData(): void
    {
        $renderer = clone $this->getContainer()->get(StringTemplateRenderer::class);
        $property = ReflectionHelper::getProperty(StringTemplateRenderer::class, 'twig');
        $environment = new TestEnvironment($property->getValue($renderer)->getLoader());
        $property->setValue($renderer$environment);

        $mailService = new MailService(
            $this->createMock(DataValidator::class),
            $renderer,
            $this->getContainer()->get(MailFactory::class),
            $this->createMock(AbstractMailSender::class),
            $this->createMock(EntityRepository::class),
            $this->getContainer()->get(SalesChannelDefinition::class),
            $this->getContainer()->get('sales_channel.repository'),
            $this->getContainer()->get(SystemConfigService::class),
            $this->getContainer()->get('event_dispatcher'),
            $this->createMock(UrlGeneratorInterface::class),
            $this->createMock(LoggerInterface::class)
        );
Home | Imprint | This part of the site doesn't use cookies.