private function resolveThemeName(ThemeAwareTenantInterface $tenant)
 {
     $themeName = $tenant->getThemeName();
     if (null !== $themeName) {
         return $tenant->getThemeName() . ThemeHelper::SUFFIX_SEPARATOR . $tenant->getCode();
     }
     return $themeName;
 }
 public function it_throws_no_theme_exception_if_tenant_has_no_theme(TenantContextInterface $tenantContext, ThemeAwareTenantInterface $tenant, $themeRepository)
 {
     $tenant->getSubdomain()->willReturn('subdomain');
     $tenant->getCode()->willReturn('code');
     $tenant->getThemeName()->willReturn(null);
     $tenantContext->getTenant()->willReturn($tenant);
     $themeRepository->findOneByName(null)->shouldBeCalled()->willReturn(null);
     $this->shouldThrow('SWP\\Bundle\\CoreBundle\\Exception\\NoThemeException')->during('getTheme');
 }
 /**
  * @param ThemeAwareTenantInterface $defaultTenant
  *
  * @throws \Exception if there is no default tenant
  */
 private function assignDefaultTheme(ThemeAwareTenantInterface $defaultTenant)
 {
     // Only assign default theme if no theme has yet been assigned to default tenant
     if (null === $defaultTenant->getThemeName()) {
         $defaultTenant->setThemeName(self::DEFAULT_THEME_NAME);
         $documentManager = $this->getContainer()->get('swp.object_manager.tenant');
         $documentManager->flush();
     }
 }