예제 #1
0
 /**
  * @covers ::persist
  * @covers ::loadPersistors
  * @covers ::doPersist
  * @covers ::updateConfigOverridedSectionsForSite
  */
 public function test_persistWithConfigPerSite()
 {
     $this->application->setIs_Started(true);
     $this->application->getConfig()->setSection('config', array('persistor' => 'BackBee\\Config\\Tests\\Persistor\\FakePersistor'));
     $this->application->getConfig()->setSection('parameters', array('hello' => 'foo'));
     $this->application->setContainer(new Container());
     $this->application->getContainer()->set('container.builder', new FakeContainerBuilder());
     $current_config = $this->application->getConfig()->getAllRawSections();
     $this->application->setSite($site = new Site());
     $this->persistor->persist($this->application->getConfig(), true);
     $this->assertTrue($this->application->getConfig()->getSection('override_site') !== null);
     $updated_override_section = array('override_site' => array($site->getUid() => array('parameters' => array('hello' => 'foo'), 'config' => array('persistor' => 'BackBee\\Config\\Tests\\Persistor\\FakePersistor'))));
     $this->assertEquals(array_merge($current_config, $updated_override_section), $this->application->getConfig()->getAllRawSections());
     $this->assertEquals(array_merge($this->configurator->getConfigDefaultSections($this->application->getConfig()), $updated_override_section), $this->application->getContainer()->getParameter('config_to_persist'));
 }