/**
  * {@inheritdoc}
  */
 public function getThemeHierarchy(ThemeInterface $theme)
 {
     $parents = [];
     $parentsSlugs = $theme->getParentsSlugs();
     foreach ($parentsSlugs as $parentName) {
         $parents = array_merge($parents, $this->getThemeHierarchy($this->getTheme($parentName)));
     }
     return array_merge([$theme], $parents);
 }
 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]);
 }