public function testGetRealFile()
 {
     $realPath = realpath(__DIR__ . '/../../Resources/config/mailer.xml');
     $file = '@SonatraMailerBundle/Resources/config/mailer.xml';
     $file = ContainerUtil::getRealFile($this->getContainer(), $file);
     $this->assertSame($realPath, realpath($file));
 }
 /**
  * Optimize the twig loader.
  *
  * @param ContainerBuilder $container The container
  * @param string           $type      The layout or mail type
  */
 protected function optimize(ContainerBuilder $container, $type)
 {
     $templateConfig = new ConfigTemplate(TwigLayout::class, TwigMail::class, TwigLayoutTranslation::class, TwigMailTranslation::class);
     $serviceId = sprintf('sonatra_mailer.loader.%s_twig', $type);
     $def = $container->getDefinition($serviceId);
     $configs = $def->getArgument(0);
     ContainerUtil::addTemplates($container, $type, $configs, $templateConfig);
 }
 /**
  * Create the config.
  *
  * @param ContainerBuilder $container
  * @param array            $templateConfig
  *
  * @return array
  */
 protected function createConfig(ContainerBuilder $container, array $templateConfig)
 {
     $file = ContainerUtil::getRealFile($container, $templateConfig['file']);
     $config = Yaml::parse(file_get_contents($file));
     if (isset($templateConfig['name'])) {
         $config['name'] = $templateConfig['name'];
     }
     return $config;
 }
 /**
  * Optimize the config loader.
  *
  * @param ContainerBuilder $container The container
  * @param string           $type      The layout or mail type
  */
 protected function optimize(ContainerBuilder $container, $type)
 {
     $serviceId = sprintf('sonatra_mailer.loader.%s_config', $type);
     $def = $container->getDefinition($serviceId);
     ContainerUtil::addTemplates($container, $type, $def->getArgument(0));
 }