function it_uses_the_given_template_when_found(MailInterface $mail, TemplateMappingInterface $testMapping, FilterChainInterface $filterChain) { $template = 'test'; $view = 'TestBundle:Mail:test.html.twig'; $contentType = 'text'; $testMapping->getMappings()->willReturn(array($template => array(array('view' => $view, 'contentType' => $contentType)))); $this->addMapping(new DefaultMapping()); $this->addMapping($testMapping); $mail->addParameter(Argument::any(), Argument::any())->willReturn(null); $mail->getTemplate()->willReturn('test'); $mail->transform(Argument::type('Symfony\\Component\\Templating\\EngineInterface'), $filterChain, array(array('view' => $view, 'contentType' => $contentType)))->willReturn(new \Swift_Message()); $message = $this->render($mail); $message->shouldHaveType('\\Swift_Message'); }
/** * {@inheritdoc} */ public function addMapping(TemplateMappingInterface $mapping) { $this->mappings = array_merge($this->mappings, $mapping->getMappings()); }