/** * * @test * @return void */ public function mergeWithExistingConfigurationOverwritesDefaultKeysWithCurrent() { $configurationManagerMock = $this->getAccessibleMock('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager'); $configurationManagerMock->expects($this->once())->method('getConfigurationValueByPath')->with('EXT/extConf/testextensionkey')->will($this->returnValue(serialize(array('FE.' => array('enabled' => '1', 'saltedPWHashingMethod' => 'TYPO3\\CMS\\Saltedpasswords\\Salt\\SaltInterface_sha1'), 'CLI.' => array('enabled' => '0'))))); $this->configurationItemRepository->injectConfigurationManager($configurationManagerMock); $defaultConfiguration = array('FE.enabled' => array('value' => '0'), 'FE.saltedPWHashingMethod' => array('value' => 'TYPO3\\CMS\\Saltedpasswords\\Salt\\Md5Salt'), 'BE.enabled' => array('value' => '1'), 'BE.saltedPWHashingMethod' => array('value' => 'TYPO3\\CMS\\Saltedpasswords\\Salt\\Md5Salt')); $expectedResult = array('FE.enabled' => array('value' => '1'), 'FE.saltedPWHashingMethod' => array('value' => 'TYPO3\\CMS\\Saltedpasswords\\Salt\\SaltInterface_sha1'), 'BE.enabled' => array('value' => '1'), 'BE.saltedPWHashingMethod' => array('value' => 'TYPO3\\CMS\\Saltedpasswords\\Salt\\Md5Salt'), 'CLI.enabled' => array('value' => '0')); $result = $this->configurationItemRepository->_call('mergeWithExistingConfiguration', $defaultConfiguration, array('key' => 'testextensionkey')); $this->assertEquals($expectedResult, $result); }
/** * @test * @return void */ public function mergeWithExistingConfigurationOverwritesDefaultKeysWithCurrent() { $localConfiguration = serialize(array('FE.' => array('enabled' => '1', 'saltedPWHashingMethod' => \TYPO3\CMS\Saltedpasswords\Salt\SaltInterface_sha1::class), 'CLI.' => array('enabled' => '0'))); $configurationManagerMock = $this->getMock(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class); $configurationManagerMock->expects($this->once())->method('getConfigurationValueByPath')->with('EXT/extConf/testextensionkey')->will($this->returnValue($localConfiguration)); $this->injectedObjectManagerMock->expects($this->any())->method('get')->will($this->returnValue($configurationManagerMock)); $defaultConfiguration = array('FE.enabled' => array('value' => '0'), 'FE.saltedPWHashingMethod' => array('value' => \TYPO3\CMS\Saltedpasswords\Salt\Md5Salt::class), 'BE.enabled' => array('value' => '1'), 'BE.saltedPWHashingMethod' => array('value' => \TYPO3\CMS\Saltedpasswords\Salt\Md5Salt::class)); $expectedResult = array('FE.enabled' => array('value' => '1'), 'FE.saltedPWHashingMethod' => array('value' => \TYPO3\CMS\Saltedpasswords\Salt\SaltInterface_sha1::class), 'BE.enabled' => array('value' => '1'), 'BE.saltedPWHashingMethod' => array('value' => \TYPO3\CMS\Saltedpasswords\Salt\Md5Salt::class), 'CLI.enabled' => array('value' => '0')); $actualResult = $this->configurationItemRepository->_call('mergeWithExistingConfiguration', $defaultConfiguration, 'testextensionkey'); $this->assertEquals($expectedResult, $actualResult); }