function it_loads_a_theme_with_author(ConfigurationProviderInterface $configurationProvider, ThemeFactoryInterface $themeFactory, ThemeAuthorFactoryInterface $themeAuthorFactory, HydrationInterface $themeHydrator, CircularDependencyCheckerInterface $circularDependencyChecker, ThemeInterface $theme) { $themeAuthor = new ThemeAuthor(); $configurationProvider->getConfigurations()->willReturn([['name' => 'first/theme', 'path' => '/theme/path', 'parents' => [], 'authors' => [['name' => 'Richard Rynkowsky']], 'screenshots' => []]]); $themeFactory->create('first/theme', '/theme/path')->willReturn($theme); $themeAuthorFactory->createFromArray(['name' => 'Richard Rynkowsky'])->willReturn($themeAuthor); $themeHydrator->hydrate(['name' => 'first/theme', 'path' => '/theme/path', 'parents' => [], 'authors' => [$themeAuthor], 'screenshots' => []], $theme)->willReturn($theme); $circularDependencyChecker->check($theme)->shouldBeCalled(); $this->load()->shouldReturn([$theme]); }
/** * @param array $authorsArrays * * @return ThemeAuthor[] */ private function convertAuthorsArraysToAuthorsObjects(array $authorsArrays) { return array_map(function (array $authorArray) { return $this->themeAuthorFactory->createFromArray($authorArray); }, $authorsArrays); }