本文整理汇总了PHP中Sylius\Bundle\ThemeBundle\Model\ThemeInterface类的典型用法代码示例。如果您正苦于以下问题:PHP ThemeInterface类的具体用法?PHP ThemeInterface怎么用?PHP ThemeInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ThemeInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function it_throws_an_exception_if_resource_can_not_be_located(Filesystem $filesystem, ThemeInterface $theme)
{
$theme->getName()->willReturn('theme/name');
$theme->getPath()->willReturn('/theme/path');
$filesystem->exists('/theme/path/resource')->willReturn(false);
$this->shouldThrow(ResourceNotFoundException::class)->during('locateResource', ['resource', $theme]);
}
示例2: let
function let(LoaderInterface $loader, Collection $resourcesToThemes, ThemeInterface $theme)
{
$theme->getLogicalName()->willReturn("sylius/sample-theme");
$resourcesToThemes->get(realpath($this->getThemeTranslationResourcePath()))->willReturn($theme);
$resourcesToThemes->get(realpath($this->getVanillaTranslationResourcePath()))->willReturn(null);
$this->beConstructedWith($loader, $resourcesToThemes);
}
示例3:
function it_throws_an_exception_if_settings_schema_does_not_exist(ThemeInterface $theme)
{
$theme->getTitle()->willReturn('Candy shop');
$theme->getName()->willReturn('candy/shop');
$theme->getPath()->willReturn($this->vfsStream->url());
$this->shouldThrow(new \InvalidArgumentException(sprintf('Could not find settings schema of theme "Candy shop" (candy/shop) in file "%s"', $this->vfsStream->url() . '/Settings.php')))->during('getSchema', [$theme]);
}
示例4: updateTheme
/**
* @param ThemeInterface $theme
*/
private function updateTheme(ThemeInterface $theme)
{
$existingTheme = $this->themeRepository->findOneByName($theme->getName());
if (null !== $existingTheme) {
$theme = $this->themeMerger->merge($existingTheme, $theme);
}
$this->themeRepository->add($theme);
}
示例5: locateResource
/**
* {@inheritdoc}
*/
public function locateResource($resourceName, ThemeInterface $theme)
{
$path = sprintf('%s/%s', $theme->getPath(), $resourceName);
if (!$this->filesystem->exists($path)) {
throw new ResourceNotFoundException($resourceName, $theme);
}
return $path;
}
示例6: it_defines_themes_names_choices
public function it_defines_themes_names_choices(OptionsResolver $resolver, ThemeProviderInterface $themeProvider, ThemeInterface $theme)
{
$theme->getName()->willReturn('swp/theme-name');
$themeProvider->getCurrentTenantAvailableThemes()->willReturn([$theme]);
$resolver->setNormalizer('choices', Argument::type('callable'))->willReturn($resolver);
$resolver->setDefaults(['invalid_message' => 'The selected theme does not exist'])->shouldBeCalled();
$this->configureOptions($resolver);
}
示例7: it_should_return_global_variables
public function it_should_return_global_variables(ThemeInterface $theme, ThemeContextInterface $themeContext)
{
$theme->getName()->willReturn('swp/theme-one');
$theme->getPath()->willReturn('/path/to/theme/');
$themeContext->getTheme()->shouldBeCalled()->willReturn($theme);
$globals = ['theme' => $theme];
$this->getGlobals()->shouldReturn($globals);
}
示例8: getThemeHierarchy
/**
* {@inheritdoc}
*/
public function getThemeHierarchy(ThemeInterface $theme)
{
$parents = [];
$parentsNames = $theme->getParentsNames();
foreach ($parentsNames as $parentName) {
$parents = array_merge($parents, $this->getThemeHierarchy($this->getTheme($parentName)));
}
return array_merge([$theme], $parents);
}
示例9: getScreenshotPath
/**
* @param ThemeInterface $theme
* @param int $screenshotNumber
*
* @return string
*/
private function getScreenshotPath(ThemeInterface $theme, $screenshotNumber)
{
$screenshots = $theme->getScreenshots();
if (!isset($screenshots[$screenshotNumber])) {
throw new NotFoundHttpException(sprintf('Theme "%s" does not have screenshot #%d', $theme->getTitle(), $screenshotNumber));
}
$screenshotRelativePath = $screenshots[$screenshotNumber];
return rtrim($theme->getPath(), \DIRECTORY_SEPARATOR) . \DIRECTORY_SEPARATOR . $screenshotRelativePath;
}
示例10:
function it_registers_theme_schema_alias_if_not_exists_during_loading_settings(SettingsManagerInterface $decoratedSettingsManager, ServiceRegistryInterface $schemaRegistry, ThemeSettingsSchemaProviderInterface $themeSettingsSchemaProvider, ThemeInterface $theme, SettingsInterface $settings, SchemaInterface $schema)
{
$theme->getName()->willReturn('theme/name');
$schemaRegistry->has('theme_theme/name')->willReturn(false);
$themeSettingsSchemaProvider->getSchema($theme)->willReturn($schema);
$schemaRegistry->register('theme_theme/name', $schema)->shouldBeCalled();
$decoratedSettingsManager->load('theme_theme/name', null)->willReturn($settings);
$this->load($theme)->shouldReturn($settings);
}
示例11:
function it_transforms_a_cycle_to_user_friendly_message(ThemeInterface $firstTheme, ThemeInterface $secondTheme, ThemeInterface $thirdTheme, ThemeInterface $fourthTheme)
{
$this->beConstructedWith([$firstTheme, $secondTheme, $thirdTheme, $fourthTheme, $thirdTheme]);
$firstTheme->getName()->willReturn('first/theme');
$secondTheme->getName()->willReturn('second/theme');
$thirdTheme->getName()->willReturn('third/theme');
$fourthTheme->getName()->willReturn('fourth/theme');
$this->getMessage()->shouldReturn('Circular dependency was found while resolving theme "first/theme", caused by cycle "third/theme -> fourth/theme -> third/theme".');
}
示例12:
function it_returns_an_array_of_translation_resources_paths(FinderFactoryInterface $finderFactory, Finder $finder, ThemeInterface $theme)
{
$finderFactory->create()->willReturn($finder);
$theme->getPath()->willReturn('/theme');
$finder->in('/theme')->shouldBeCalled()->willReturn($finder);
$finder->ignoreUnreadableDirs()->shouldBeCalled()->willReturn($finder);
$finder->getIterator()->willReturn(new \ArrayIterator(['/theme/messages.en.yml', '/theme/translations/messages.en.yml', '/theme/translations/messages.en.yml.jpg', '/theme/translations/messages.yml', '/theme/AcmeBundle/translations/messages.pl_PL.yml']));
$this->findTranslationFiles($theme)->shouldReturn(['/theme/translations/messages.en.yml', '/theme/AcmeBundle/translations/messages.pl_PL.yml']);
}
示例13: load
/**
* {@inheritdoc}
*/
public function load(ThemeInterface $theme, $namespace = null)
{
$schemaAlias = sprintf('theme_%s', $theme->getName());
if (!$this->schemaRegistry->has($schemaAlias)) {
$schema = $this->themeSettingsSchemaProvider->getSchema($theme);
$this->schemaRegistry->register($schemaAlias, $schema);
}
return $this->decoratedSettingsManager->load($schemaAlias, $namespace);
}
示例14: getApplicationPaths
/**
* @param string $resourceName
* @param ThemeInterface $theme
*
* @return array
*/
protected function getApplicationPaths($resourceName, ThemeInterface $theme)
{
$paths = [sprintf('%s/%s', $theme->getPath(), $resourceName)];
if ($this->deviceDetection->getType() !== null) {
$paths[] = sprintf('%s/%s/%s', $theme->getPath(), $this->deviceDetection->getType(), $resourceName);
krsort($paths);
}
return $paths;
}
示例15:
function it_returns_theme_list_in_hierarchized_order(ThemeRepositoryInterface $themeRepository, ThemeInterface $firstTheme, ThemeInterface $secondTheme)
{
$firstTheme->getName()->willReturn('foo/bar1');
$firstTheme->getParentsNames()->willReturn(['foo/bar2']);
$secondTheme->getName()->willReturn('foo/bar2');
$secondTheme->getParentsNames()->willReturn([]);
$themeRepository->findOneByName('foo/bar1')->willReturn($firstTheme);
$themeRepository->findOneByName('foo/bar2')->willReturn($secondTheme);
$this->getThemeHierarchy($firstTheme)->shouldReturn([$firstTheme, $secondTheme]);
}