コード例 #1
0
ファイル: ThemeLoader.php プロジェクト: ReissClothing/Sylius
 /**
  * @param ThemeInterface[] $themes
  */
 private function checkForCircularDependencies(array $themes)
 {
     try {
         foreach ($themes as $theme) {
             $this->circularDependencyChecker->check($theme);
         }
     } catch (CircularDependencyFoundException $exception) {
         throw new ThemeLoadingFailedException('Circular dependency found.', 0, $exception);
     }
 }
コード例 #2
0
ファイル: ThemeLoaderSpec.php プロジェクト: ahmadrabie/Sylius
 function it_throws_an_exception_if_there_is_a_circular_dependency_found(ConfigurationProviderInterface $configurationProvider, ThemeFactoryInterface $themeFactory, HydrationInterface $themeHydrator, CircularDependencyCheckerInterface $circularDependencyChecker, ThemeInterface $firstTheme, ThemeInterface $secondTheme)
 {
     $configurationProvider->getConfigurations()->willReturn([['name' => 'first/theme', 'parents' => ['second/theme'], 'authors' => []], ['name' => 'second/theme', 'parents' => ['first/theme'], 'authors' => []]]);
     $themeFactory->createNamed('first/theme')->willReturn($firstTheme);
     $themeFactory->createNamed('second/theme')->willReturn($secondTheme);
     $themeHydrator->hydrate(['name' => 'first/theme', 'parents' => [$secondTheme], 'authors' => []], $firstTheme)->willReturn($firstTheme);
     $themeHydrator->hydrate(['name' => 'second/theme', 'parents' => [$firstTheme], 'authors' => []], $secondTheme)->willReturn($secondTheme);
     $circularDependencyChecker->check(Argument::cetera())->willThrow(CircularDependencyFoundException::class);
     $this->shouldThrow(new ThemeLoadingFailedException('Circular dependency found.'))->during('load');
 }