TestEnvironment example


class MailServiceTest extends TestCase
{
    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),
            
Home | Imprint | This part of the site doesn't use cookies.