function it_loads_a_theme_with_screenshot(ConfigurationProviderInterface $configurationProvider, ThemeFactoryInterface $themeFactory, ThemeScreenshotFactoryInterface $themeScreenshotFactory, HydrationInterface $themeHydrator, CircularDependencyCheckerInterface $circularDependencyChecker, ThemeInterface $theme)
 {
     $themeScreenshot = new ThemeScreenshot('screenshot/omg.jpg');
     $configurationProvider->getConfigurations()->willReturn([['name' => 'first/theme', 'path' => '/theme/path', 'parents' => [], 'authors' => [], 'screenshots' => [['path' => 'screenshot/omg.jpg', 'title' => 'Title']]]]);
     $themeFactory->create('first/theme', '/theme/path')->willReturn($theme);
     $themeScreenshotFactory->createFromArray(['path' => 'screenshot/omg.jpg', 'title' => 'Title'])->willReturn($themeScreenshot);
     $themeHydrator->hydrate(['name' => 'first/theme', 'path' => '/theme/path', 'parents' => [], 'authors' => [], 'screenshots' => [$themeScreenshot]], $theme)->willReturn($theme);
     $circularDependencyChecker->check($theme)->shouldBeCalled();
     $this->load()->shouldReturn([$theme]);
 }
Exemple #2
0
 /**
  * @param array $screenshotsArrays
  *
  * @return ThemeScreenshot[]
  */
 private function convertScreenshotsArraysToScreenshotsObjects(array $screenshotsArrays)
 {
     return array_map(function (array $screenshotArray) {
         return $this->themeScreenshotFactory->createFromArray($screenshotArray);
     }, $screenshotsArrays);
 }