public function init()
 {
     // Ensure that persistence cache purger is disabled as legacy cache will be cleared by legacy setup wizard while
     // everything is not ready yet to clear SPI cache (no connection to repository yet).
     $this->persistenceCachePurger->switchOff();
     // we disable injection of settings to Legacy Kernel during setup
     $this->kernelFactory->setBuildEventsEnabled(false);
     /** @var $request \Symfony\Component\HttpFoundation\ParameterBag */
     $request = $this->container->get('request')->request;
     // inject the extra ezpublish-community folders we want permissions checked for
     switch ($request->get('eZSetup_current_step')) {
         case 'Welcome':
         case 'SystemCheck':
             $this->getLegacyKernel()->runCallback(function () {
                 eZINI::injectSettings(array('setup.ini' => array('directory_permissions' => array('CheckList' => '../ezpublish/logs;../ezpublish/cache;../ezpublish/config;' . eZINI::instance('setup.ini')->variable('directory_permissions', 'CheckList')))));
             });
     }
     $response = new Response();
     $response->setContent($this->getLegacyKernel()->run()->getContent());
     // After the latest step, we can re-use both POST data and written INI settings
     // to generate a local ezpublish_<env>.yml
     // Clear INI cache since setup has written new files
     $this->getLegacyKernel()->runCallback(function () {
         eZINI::injectSettings(array());
         eZCache::clearByTag('ini');
         eZINI::resetAllInstances();
     });
     // Check that eZ Publish Legacy was actually installed, since one step can run several steps
     if ($this->legacyConfigResolver->getParameter('SiteAccessSettings.CheckValidity') == 'false') {
         // If using kickstart.ini, legacy wizard will artificially create entries in $_POST
         // and in this case Symfony Request is not aware of them.
         // We then add them manually to the ParameterBag.
         if (!$request->has('P_chosen_site_package-0')) {
             $request->add($_POST);
         }
         $chosenSitePackage = $request->get('P_chosen_site_package-0');
         // match mode (host, url or port)
         switch ($request->get('P_site_extra_data_access_type-' . $chosenSitePackage)) {
             case 'hostname':
             case 'port':
                 $adminSiteaccess = $chosenSitePackage . '_admin';
                 break;
             case 'url':
                 $adminSiteaccess = $request->get('P_site_extra_data_admin_access_type_value-' . $chosenSitePackage);
         }
         /** @var $configurationDumper \eZ\Bundle\EzpublishLegacyBundle\SetupWizard\ConfigurationDumper */
         $configurationDumper = $this->container->get('ezpublish_legacy.setup_wizard.configuration_dumper');
         $configurationDumper->addEnvironment($this->container->get('kernel')->getEnvironment());
         $configurationDumper->dump($this->container->get('ezpublish_legacy.setup_wizard.configuration_converter')->fromLegacy($chosenSitePackage, $adminSiteaccess), ConfigDumperInterface::OPT_BACKUP_CONFIG);
     }
     return $response;
 }
 /**
  * @covers eZ\Bundle\EzPublishLegacyBundle\Cache\PersistenceCachePurger::setEnabled
  * @covers eZ\Bundle\EzPublishLegacyBundle\Cache\PersistenceCachePurger::all
  */
 public function testClearAllDisabled()
 {
     $this->cachePurger->switchOff();
     $this->cacheService->expects($this->never())->method('clear');
     $this->cachePurger->all();
 }