/** * setup a wrong bootstrap.yml to raise MissingBootstrapParametersException. * * @covers ::hydrateContainerWithBootstrapParameters */ public function testRaiseOfMissingBootstrapParametersException() { $this->application->setContext('fake_bootstrap'); $this->application->setRepository($this->application->getBaseRepository() . DIRECTORY_SEPARATOR . $this->application->getContext()); $container_builder = new ContainerBuilder($this->application); try { $container_proxy = $container_builder->getContainer(); $this->fail('Raise of MissingBootstrapParametersException expected.'); } catch (\Exception $e) { $this->assertInstanceOf('BackBee\\DependencyInjection\\Exception\\MissingBootstrapParametersException', $e); } }
/** * @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')); }