/** * @test */ public function setTypeConverterOptionShouldOverrideAlreadySetOptions() { $mockTypeConverterClass = $this->getMockClass('TYPO3\\CMS\\Extbase\\Property\\TypeConverterInterface'); $this->propertyMappingConfiguration->setTypeConverterOptions($mockTypeConverterClass, array('k1' => 'v1', 'k2' => 'v2')); $this->propertyMappingConfiguration->setTypeConverterOption($mockTypeConverterClass, 'k1', 'v3'); $this->assertEquals('v3', $this->propertyMappingConfiguration->getConfigurationValue($mockTypeConverterClass, 'k1')); $this->assertEquals('v2', $this->propertyMappingConfiguration->getConfigurationValue($mockTypeConverterClass, 'k2')); }
/** * @test */ public function getTypeOfChildPropertyShouldUseReflectionServiceToDetermineType() { $this->mockReflectionService->expects($this->any())->method('hasMethod')->with('TheTargetType', 'setThePropertyName')->will($this->returnValue(FALSE)); $this->mockReflectionService->expects($this->any())->method('getMethodParameters')->with('TheTargetType', '__construct')->will($this->returnValue(array( 'thePropertyName' => array( 'type' => 'TheTypeOfSubObject', 'elementType' => NULL ) ))); $this->mockContainer->expects($this->any())->method('getImplementationClassName')->will($this->returnValue('TheTargetType')); $configuration = new PropertyMappingConfiguration(); $configuration->setTypeConverterOptions(\TYPO3\CMS\Extbase\Property\TypeConverter\ObjectConverter::class, array()); $this->assertEquals('TheTypeOfSubObject', $this->converter->getTypeOfChildProperty('TheTargetType', 'thePropertyName', $configuration)); }