/**
  * On kernel request.
  *
  * @param GetResponseEvent $event
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     $settings = $this->generalSettingsManager->getSettings();
     foreach ($settings as $id => $value) {
         $prefix = 'ongr_settings_profile_';
         if (strpos($id, $prefix) === 0 && $value === true) {
             $escapedProfile = mb_substr($id, strlen($prefix), null, 'UTF-8');
             $profile = UnderscoreEscaper::unescape($escapedProfile);
             $this->settingsContainer->addProfile($profile);
             $this->settingsContainer->addProvider($this->buildProvider($profile));
         }
     }
 }
 /**
  * Test for SettingsContainer get.
  */
 public function testGet()
 {
     $pool = new Pool();
     $settingsContainer = new SettingsContainer($pool);
     $provider = new ManagerAwareSettingProvider();
     $provider->setManager($this->getManager());
     $settingsContainer->addProvider($provider);
     // First time, it should be loaded from database.
     $settings = $settingsContainer->get('test');
     $this->assertEquals('test1', $settings);
     // Second time it should be loaded from object itself.
     $this->getManager()->getConnection()->dropIndex();
     $settings = $settingsContainer->get('test');
     $this->assertEquals('test1', $settings);
     $settings = $settingsContainer->get('test2');
     $this->assertEquals('test2', $settings);
 }
 /**
  * Test setDomains method.
  */
 public function testSetDomains()
 {
     $container = new SettingsContainer($this->getMock('\\Stash\\Interfaces\\PoolInterface'));
     $container->setProfiles(['foo']);
     $this->assertEquals(['foo'], $container->getProfiles());
 }