public function it_defines_themes_names_choices(OptionsResolver $resolver, ThemeProviderInterface $themeProvider, ThemeInterface $theme) { $theme->getName()->willReturn('swp/theme-name'); $themeProvider->getCurrentTenantAvailableThemes()->willReturn([$theme]); $resolver->setNormalizer('choices', Argument::type('callable'))->willReturn($resolver); $resolver->setDefaults(['invalid_message' => 'The selected theme does not exist'])->shouldBeCalled(); $this->configureOptions($resolver); }
/** * {@inheritdoc} */ public function configureOptions(OptionsResolver $resolver) { $resolver->setNormalizer('choices', function () { /** @var ThemeInterface[] $themes */ $themes = $this->themeProvider->getCurrentTenantAvailableThemes(); $choices = []; foreach ($themes as $theme) { $choices[$theme->getName()] = $theme->getName(); } return $choices; })->setDefaults(['invalid_message' => 'The selected theme does not exist']); }