예제 #1
0
 /**
  * Synchronize system banner zones.
  *
  * @param string $locale
  */
 public function synchronize($locale)
 {
     $existingSystemZones = $this->manager->findSystemSlugs();
     $newZones = array();
     foreach ($this->registry->getConfigs() as $config) {
         if (false === in_array($config->getSlug(), $existingSystemZones)) {
             $newZones[] = $this->createZone($config);
         }
     }
     if (0 < count($newZones)) {
         $this->manager->save();
         foreach ($newZones as $zone) {
             $this->eventDispatcher->dispatch(BannerZoneEvents::CREATE, new BannerZoneEvent($zone, $locale));
         }
     }
 }
예제 #2
0
 public function testGetConfigs()
 {
     $this->assertEmpty($this->registry->getConfigs());
     $config = $this->createConfig('silvestra');
     $this->registry->addConfig($config);
     $configs = $this->registry->getConfigs();
     $this->assertCount(1, $configs);
     $this->assertEquals($config, $configs['silvestra']);
     $this->registry->addConfig($config);
     $configs = $this->registry->getConfigs();
     $this->assertCount(1, $configs);
     $this->assertEquals($config, $configs['silvestra']);
 }