Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function locateResource($resourcePath, ThemeInterface $theme)
 {
     if (0 === strpos($resourcePath, '@')) {
         return $this->bundleResourceLocator->locateResource($resourcePath, $theme);
     }
     return $this->applicationResourceLocator->locateResource($resourcePath, $theme);
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function locateTemplate(TemplateReferenceInterface $template, ThemeInterface $theme)
 {
     return $this->resourceLocator->locateResource($template->getPath(), $theme);
 }
 function it_does_not_catch_exceptions_thrown_while_locating_template_to_resource_locator_even(ResourceLocatorInterface $resourceLocator, TemplateReferenceInterface $template, ThemeInterface $theme)
 {
     $template->getPath()->willReturn('@AcmeBundle/Resources/views/index.html.twig');
     $resourceLocator->locateResource('@AcmeBundle/Resources/views/index.html.twig', $theme)->willThrow(ResourceNotFoundException::class);
     $this->shouldThrow(ResourceNotFoundException::class)->during('locateTemplate', [$template, $theme]);
 }
Exemplo n.º 4
0
 function it_proxies_locating_resource_to_application_resource_locator_if_resource_path_does_not_start_with_an_asperand(ResourceLocatorInterface $applicationResourceLocator, ResourceLocatorInterface $bundleResourceLocator, ThemeInterface $theme)
 {
     $bundleResourceLocator->locateResource(Argument::cetera())->shouldNotBeCalled();
     $applicationResourceLocator->locateResource('AcmeBundle/resource', $theme)->shouldBeCalled();
     $this->locateResource('AcmeBundle/resource', $theme);
 }
 /**
  * @param TemplateReferenceInterface $template
  * @param ThemeInterface[] $themes
  *
  * @return null|string
  */
 protected function locateAppTemplateUsingThemes(TemplateReferenceInterface $template, array $themes = [])
 {
     $cacheKey = $this->getCacheKey($template, $this->themeContext->getTheme());
     return $this->cache[$cacheKey] = $this->applicationResourceLocator->locateResource($template->getPath(), $themes);
 }