コード例 #1
0
 public function it_should_set_template_name_from_route_with_content(RouteInterface $route, ArticleInterface $article)
 {
     $route->getTemplateName()->willReturn('test.html.twig');
     $route->getContent()->willReturn($article);
     $article->getRoute()->willReturn(null);
     $article->getTemplateName()->willReturn(null);
     $this->setTemplateName($article, [RouteObjectInterface::ROUTE_OBJECT => $route])->shouldReturn([RouteObjectInterface::ROUTE_OBJECT => $route, RouteObjectInterface::TEMPLATE_NAME => 'article.html.twig']);
 }
コード例 #2
0
 /**
  * @param RouteInterface $route
  *
  * @return bool
  */
 private function getTemplateNameFromRouteContent(RouteInterface $route)
 {
     if (null !== $route->getContent()) {
         if (null !== ($templateName = $route->getContent()->getTemplateName())) {
             return $templateName;
         }
     }
     return false;
 }