public function testBuildSiteHandlingTheme()
 {
     $folders = array('RedKiteCMS' => array('app' => array('cache' => array(), 'config' => array(), 'data' => array('redkitecms.com' => array('config' => array(), 'pages' => array('pages' => array()), 'roles' => array(), 'slots' => array(), 'users' => array())), 'logs' => array(), 'plugins' => array('RedKiteCms' => array('Block' => array(), 'Theme' => array())), 'RedKiteCms.php' => 'class RedKiteCms extends RedKiteCmsBase{}'), 'src' => array(), 'web' => array()));
     vfsStream::setup('www', null, $folders);
     $siteBuilder = new SiteBuilder(vfsStream::url('www/RedKiteCMS'), 'redkitecms.com');
     $siteBuilder->theme("FooTheme")->handleTheme(true)->build();
     $structure = vfsStream::inspect(new \org\bovigo\vfs\visitor\vfsStreamStructureVisitor())->getStructure();
     $siteStructure = array("redkitecms.com" => array("config" => array(), "pages" => array("pages" => array()), "roles" => array("roles.json" => '["ROLE_ADMIN"]'), "slots" => array(), "users" => array("users.json" => '{"admin":{"roles":["ROLE_ADMIN"],"password":"RVxE\\/NkQGEhSimsAzsmSIwDv1p+lhP5SDT6Gfnh8QS32yk7W6A+pW5GXUBxJ3ud9La5khARoH2uQ5VRYkPG\\/Fw==","salt":"q4mfgrnsn2occ4kw4k008cskkwkg800"}}'), "RedKiteCms.php" => 'class RedKiteCms extends RedKiteCmsBase{}', "site.json" => '{"theme":"FooTheme","homepage":"homepage","locale_default":"en_GB","homepage_permalink":"en-gb-homepage","languages":["en_GB"],"handled_theme":"FooTheme"}', "incomplete.json" => null));
     $this->assertEquals($siteStructure, $structure["www"]["RedKiteCMS"]["app"]["data"]);
 }
 public function start(array $options)
 {
     $resolver = new OptionsResolver();
     $this->configureOptions($resolver);
     $this->options = $resolver->resolve($options);
     $siteDir = $this->options["configuration_handler"]->siteDir();
     $fs = new Filesystem();
     $fs->remove($siteDir);
     $themeName = $options["request"]->get('theme');
     $siteBuilder = new SiteBuilder($this->options["configuration_handler"]->rootDir(), $this->options["configuration_handler"]->siteName());
     if ($this->options["configuration_handler"]->isTheme()) {
         $siteBuilder->handleTheme();
     }
     $siteBuilder->theme($themeName)->build();
     return $this->buildJSonResponse(array());
 }
 private function initCmsRequiredServices()
 {
     $configurationOptions = $this->configure();
     $this->app["red_kite_cms.configuration_handler"] = new ConfigurationHandler($this->app["red_kite_cms.root_dir"], $this->siteName);
     $this->app["red_kite_cms.configuration_handler"]->setConfigurationOptions($configurationOptions);
     $siteNameDir = $this->app["red_kite_cms.root_dir"] . '/app/data/' . $this->siteName;
     if (!is_dir($siteNameDir)) {
         $siteBuilder = new SiteBuilder($this->app["red_kite_cms.root_dir"], $this->siteName);
         $siteBuilder->build();
     }
     $this->app["red_kite_cms.configuration_handler"]->boot();
     $this->frameworkAbsoluteDir = $this->app["red_kite_cms.configuration_handler"]->frameworkAbsoluteDir();
 }