public function loadConfigurationOverridesSettingsByContext() { $mockConfigurationSource = $this->getMockBuilder(YamlSource::class)->setMethods(['load', 'save'])->getMock(); $mockConfigurationSource->expects($this->any())->method('load')->will($this->returnCallback([$this, 'packageSettingsCallback'])); $mockPackageA = $this->getMockBuilder(Package::class)->disableOriginalConstructor()->getMock(); $mockPackageA->expects($this->any())->method('getConfigurationPath')->will($this->returnValue('PackageA/Configuration/')); $mockPackageA->expects($this->any())->method('getPackageKey')->will($this->returnValue('PackageA')); $mockPackages = ['PackageA' => $mockPackageA]; $configurationManager = $this->getAccessibleMock(ConfigurationManager::class, ['postProcessConfiguration'], [new ApplicationContext('Testing')]); $configurationManager->_set('configurationSource', $mockConfigurationSource); $configurationManager->expects($this->once())->method('postProcessConfiguration'); $configurationManager->_call('loadConfiguration', ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, $mockPackages); $actualConfigurations = $configurationManager->_get('configurations'); $expectedSettings = ['foo' => 'D', 'bar' => 'A']; $this->assertSame($expectedSettings, $actualConfigurations[ConfigurationManager::CONFIGURATION_TYPE_SETTINGS]['PackageA']); }