Example #1
0
 public function testConfigWhenItIsSetExplicitlyForSection()
 {
     $section1Config = ['test'];
     $configExtras = [new TestConfigSection('section1'), new TestConfigSection('section2')];
     $this->context->setConfigExtras($configExtras);
     $this->context->setClassName('Test\\Class');
     $this->configProvider->expects($this->never())->method('getConfig');
     $this->context->setConfigOf('section1', $section1Config);
     $this->assertTrue($this->context->hasConfigOf('section1'));
     $this->assertEquals($section1Config, $this->context->getConfigOf('section1'));
     $this->assertTrue($this->context->has(Context::CONFIG_PREFIX . 'section1'));
     $this->assertEquals($section1Config, $this->context->get(Context::CONFIG_PREFIX . 'section1'));
     $this->assertTrue($this->context->hasConfigOf('section2'));
     $this->assertNull($this->context->getConfigOf('section2'));
     $this->assertTrue($this->context->has(Context::CONFIG_PREFIX . 'section2'));
     $this->assertNull($this->context->get(Context::CONFIG_PREFIX . 'section2'));
     $this->assertTrue($this->context->hasConfig());
     $this->assertNull($this->context->getConfig());
     $this->assertTrue($this->context->has(Context::CONFIG_PREFIX . ConfigUtil::DEFINITION));
     $this->assertNull($this->context->get(Context::CONFIG_PREFIX . ConfigUtil::DEFINITION));
 }