public function setUp() { parent::setUp(); $this->configurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager', array('isFeatureEnabled'), array(), '', FALSE); $this->configurationManager->expects($this->any())->method('isFeatureEnabled')->with('rewrittenPropertyMapper')->will($this->returnValue(TRUE)); $this->validator->injectConfigurationManager($this->configurationManager); }
/** * @return void */ public function setUp() { $this->mockValidatorResolver = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Validation\\ValidatorResolver', array('createValidator', 'buildBaseValidatorConjunction', 'getBaseValidatorConjunction')); $this->validator = $this->getValidator(); $this->configurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager', array('isFeatureEnabled'), array(), '', FALSE); $this->configurationManager->expects($this->any())->method('isFeatureEnabled')->with('rewrittenPropertyMapper')->will($this->returnValue(TRUE)); $this->validator->injectConfigurationManager($this->configurationManager); $this->validator->_set('validatorResolver', $this->mockValidatorResolver); }
/** * @test */ public function doNotSetImageMagickDetailSettings() { /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */ $silentConfigurationUpgradeServiceInstance = $this->getAccessibleMock(SilentConfigurationUpgradeService::class, array('dummy'), array(), '', false); $currentLocalConfiguration = array(array('GFX/processor', ''), array('GFX/processor_allowTemporaryMasksAsPng', 0), array('GFX/processor_effects', 0)); $this->createConfigurationManagerWithMockedMethods(array('getLocalConfigurationValueByPath', 'getDefaultConfigurationValueByPath', 'setLocalConfigurationValuesByPathValuePairs')); $this->configurationManager->expects($this->exactly(3))->method('getLocalConfigurationValueByPath')->will($this->returnValueMap($currentLocalConfiguration)); $this->configurationManager->expects($this->never())->method('getDefaultConfigurationValueByPath'); $this->configurationManager->expects($this->never())->method('setLocalConfigurationValuesByPathValuePairs'); $silentConfigurationUpgradeServiceInstance->_set('configurationManager', $this->configurationManager); $silentConfigurationUpgradeServiceInstance->_call('setImageMagickDetailSettings'); }
/** * @test */ public function writeLocalConfigurationWritesSortedContentToConfigurationFile() { $configurationFile = PATH_site . 'typo3temp/var/tests/' . $this->getUniqueId('localConfiguration'); if (!is_file($configurationFile)) { if (!($fh = fopen($configurationFile, 'wb'))) { $this->markTestSkipped('Can not create file ' . $configurationFile . '. Please check your write permissions.'); } fclose($fh); } if (!@is_file($configurationFile)) { throw new \RuntimeException('File ' . $configurationFile . ' could not be found. Please check your write permissions', 1346364362); } $this->testFilesToDelete[] = $configurationFile; $this->subject->expects($this->any())->method('getLocalConfigurationFileLocation')->will($this->returnValue($configurationFile)); $pairs = array('foo' => 42, 'bar' => 23); $expectedContent = '<?php' . LF . 'return [' . LF . ' \'bar\' => 23,' . LF . ' \'foo\' => 42,' . LF . '];' . LF; $this->subject->writeLocalConfiguration($pairs); $this->assertSame($expectedContent, file_get_contents($configurationFile)); }