function it_ensures_cohesion_between_parent_themes(ThemeLoaderInterface $themeLoader, ThemeRepositoryInterface $themeRepository, ThemeMergerInterface $themeMerger, ThemeInterface $loadedTheme, ThemeInterface $loadedParentTheme, ThemeInterface $existingParentTheme) { $themeRepository->findAll()->willReturn([$existingParentTheme]); $existingParentTheme->getName()->willReturn('parent-theme/name'); $themeLoader->load()->willReturn([$loadedTheme, $loadedParentTheme]); $loadedTheme->getName()->willReturn('theme/name'); $loadedTheme->getParents()->willReturn([$loadedParentTheme]); $themeRepository->findOneByName('theme/name')->willReturn(null); $loadedParentTheme->getName()->willReturn('parent-theme/name'); $loadedParentTheme->getParents()->willReturn([]); $themeRepository->findOneByName('parent-theme/name')->willReturn($existingParentTheme); $loadedTheme->removeParent($loadedParentTheme)->shouldBeCalled(); $loadedTheme->addParent($existingParentTheme)->shouldBeCalled(); $themeMerger->merge($existingParentTheme, $loadedParentTheme)->willReturn($existingParentTheme); $themeRepository->add($loadedTheme)->shouldBeCalled(); $themeRepository->add($existingParentTheme)->shouldBeCalled(); $themeRepository->add($loadedParentTheme)->shouldNotBeCalled(); $this->synchronize(); }