本文整理汇总了PHP中Sylius\Bundle\ThemeBundle\Model\ThemeInterface::getSlug方法的典型用法代码示例。如果您正苦于以下问题:PHP ThemeInterface::getSlug方法的具体用法?PHP ThemeInterface::getSlug怎么用?PHP ThemeInterface::getSlug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sylius\Bundle\ThemeBundle\Model\ThemeInterface
的用法示例。
在下文中一共展示了ThemeInterface::getSlug方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function it_throws_an_exception_if_resource_can_not_be_located(Filesystem $filesystem, ThemeInterface $theme)
{
$theme->getSlug()->willReturn('theme/slug');
$theme->getPath()->willReturn('/theme/path');
$filesystem->exists('/theme/path/resource')->willReturn(false);
$this->shouldThrow(ResourceNotFoundException::class)->during('locateResource', ['resource', $theme]);
}
示例2:
function it_returns_theme_list_in_hierarchized_order(ThemeRepositoryInterface $themeRepository, ThemeInterface $firstTheme, ThemeInterface $secondTheme)
{
$firstTheme->getSlug()->willReturn("foo/bar1");
$firstTheme->getParentsSlugs()->willReturn(["foo/bar2"]);
$secondTheme->getSlug()->willReturn("foo/bar2");
$secondTheme->getParentsSlugs()->willReturn([]);
$themeRepository->findOneBySlug("foo/bar1")->willReturn($firstTheme);
$themeRepository->findOneBySlug("foo/bar2")->willReturn($secondTheme);
$this->getThemeHierarchy($firstTheme)->shouldReturn([$firstTheme, $secondTheme]);
}
示例3:
function it_throws_resource_not_found_exception_if_the_location_found_in_cache_is_null(TemplateLocatorInterface $decoratedTemplateLocator, Cache $cache, TemplateReferenceInterface $template, ThemeInterface $theme)
{
$template->getLogicalName()->willReturn('Logical:Name');
$template->getPath()->willReturn('@Acme/template.html.twig');
$theme->getSlug()->willReturn('theme/slug');
$cache->contains('Logical:Name|theme/slug')->willReturn(true);
$cache->fetch('Logical:Name|theme/slug')->willReturn(null);
$decoratedTemplateLocator->locateTemplate(Argument::cetera())->shouldNotBeCalled();
$this->shouldThrow(ResourceNotFoundException::class)->during('locateTemplate', [$template, $theme]);
}
示例4:
function it_throws_an_exception_if_resource_can_not_be_located(Filesystem $filesystem, KernelInterface $kernel, ThemeInterface $theme, BundleInterface $childBundle, BundleInterface $parentBundle)
{
$kernel->getBundle('ParentBundle', false)->willReturn([$childBundle, $parentBundle]);
$childBundle->getName()->willReturn('ChildBundle');
$parentBundle->getName()->willReturn('ParentBundle');
$theme->getSlug()->willReturn('theme/slug');
$theme->getPath()->willReturn('/theme/path');
$filesystem->exists('/theme/path/ChildBundle/views/index.html.twig')->shouldBeCalled()->willReturn(false);
$filesystem->exists('/theme/path/ParentBundle/views/index.html.twig')->shouldBeCalled()->willReturn(false);
$this->shouldThrow(ResourceNotFoundException::class)->during('locateResource', ['@ParentBundle/Resources/views/index.html.twig', $theme]);
}
示例5:
function it_builds_cache_by_warming_up_every_template_and_every_theme_together(TemplateFinderInterface $templateFinder, TemplateLocatorInterface $templateLocator, ThemeRepositoryInterface $themeRepository, Cache $cache, ThemeInterface $theme, TemplateReferenceInterface $firstTemplate, TemplateReferenceInterface $secondTemplate)
{
$templateFinder->findAllTemplates()->willReturn([$firstTemplate, $secondTemplate]);
$themeRepository->findAll()->willReturn([$theme]);
$theme->getSlug()->willReturn('theme/slug');
$firstTemplate->getLogicalName()->willReturn('Logical:Name:First');
$secondTemplate->getLogicalName()->willReturn('Logical:Name:Second');
$templateLocator->locateTemplate($firstTemplate, $theme)->willReturn('/First/Theme/index.html.twig');
$templateLocator->locateTemplate($secondTemplate, $theme)->willThrow(ResourceNotFoundException::class);
$cache->save('Logical:Name:First|theme/slug', '/First/Theme/index.html.twig')->shouldBeCalled();
$cache->save('Logical:Name:Second|theme/slug', null)->shouldBeCalled();
$this->warmUp(null);
}
示例6: getCacheKey
/**
* @param TemplateReferenceInterface $template
* @param ThemeInterface $theme
*
* @return string
*/
private function getCacheKey(TemplateReferenceInterface $template, ThemeInterface $theme)
{
return $template->getLogicalName() . '|' . $theme->getSlug();
}
示例7:
function it_returns_null_if_theme_with_given_slug_is_not_found(ThemeInterface $theme)
{
$theme->getSlug()->willReturn("foo/bar");
$this->beConstructedWith([$theme]);
$this->findOneBySlug("blah/blah")->shouldReturn(null);
}
示例8: let
function let(ThemeInterface $theme)
{
$theme->getSlug()->willReturn('theme/slug');
$this->beConstructedWith('resource name', $theme);
}
示例9:
function it_returns_id_if_there_is_no_given_choice_translation(TranslatorInterface $translator, ThemeContextInterface $themeContext, ThemeInterface $theme)
{
$theme->getSlug()->willReturn('theme/slug');
$themeContext->getThemeHierarchy()->willReturn([$theme]);
$translator->transChoice('id|theme/slug', 42, Argument::cetera())->willReturn('id|theme/slug');
$translator->transChoice('id', 42, Argument::cetera())->willReturn('id');
$this->transChoice('id', 42)->shouldReturn('id');
}
示例10: __construct
/**
* @param string $resourceName
* @param ThemeInterface $theme
*/
public function __construct($resourceName, ThemeInterface $theme)
{
parent::__construct(sprintf('Could not find resource "%s" using theme "%s".', $resourceName, $theme->getSlug()));
}