当前位置: 首页>>代码示例>>PHP>>正文


PHP ThemeInterface::getSlug方法代码示例

本文整理汇总了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]);
 }
开发者ID:benakacha,项目名称:Sylius,代码行数:7,代码来源:ApplicationResourceLocatorSpec.php

示例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]);
 }
开发者ID:benakacha,项目名称:Sylius,代码行数:10,代码来源:ThemeHierarchyProviderSpec.php

示例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]);
 }
开发者ID:benakacha,项目名称:Sylius,代码行数:10,代码来源:CachedTemplateLocatorSpec.php

示例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]);
 }
开发者ID:benakacha,项目名称:Sylius,代码行数:11,代码来源:BundleResourceLocatorSpec.php

示例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);
 }
开发者ID:benakacha,项目名称:Sylius,代码行数:13,代码来源:TemplatePathsCacheWarmerSpec.php

示例6: getCacheKey

 /**
  * @param TemplateReferenceInterface $template
  * @param ThemeInterface $theme
  *
  * @return string
  */
 private function getCacheKey(TemplateReferenceInterface $template, ThemeInterface $theme)
 {
     return $template->getLogicalName() . '|' . $theme->getSlug();
 }
开发者ID:benakacha,项目名称:Sylius,代码行数:10,代码来源:CachedTemplateLocator.php

示例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);
 }
开发者ID:benakacha,项目名称:Sylius,代码行数:6,代码来源:ThemeRepositorySpec.php

示例8: let

 function let(ThemeInterface $theme)
 {
     $theme->getSlug()->willReturn('theme/slug');
     $this->beConstructedWith('resource name', $theme);
 }
开发者ID:benakacha,项目名称:Sylius,代码行数:5,代码来源:ResourceNotFoundExceptionSpec.php

示例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');
 }
开发者ID:benakacha,项目名称:Sylius,代码行数:8,代码来源:TranslatorSpec.php

示例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()));
 }
开发者ID:benakacha,项目名称:Sylius,代码行数:8,代码来源:ResourceNotFoundException.php


注:本文中的Sylius\Bundle\ThemeBundle\Model\ThemeInterface::getSlug方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。