Set all options for the given $typeConverter.
public setTypeConverterOptions ( string $typeConverter, array $options ) : |
||
$typeConverter | string | class name of type converter |
$options | array | |
return | this |
/** * @test */ public function setTypeConverterOptionShouldOverrideAlreadySetOptions() { $mockTypeConverterClass = $this->getMockClass(TypeConverterInterface::class); $this->propertyMappingConfiguration->setTypeConverterOptions($mockTypeConverterClass, ['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')); }
/** * @param array $typeConverterOptions * @return PropertyMappingConfiguration */ protected function buildConfiguration($typeConverterOptions) { $configuration = new PropertyMappingConfiguration(); $configuration->setTypeConverterOptions(PersistentObjectConverter::class, $typeConverterOptions); return $configuration; }
/** * @test */ public function getTypeOfChildPropertyShouldRemoveLeadingBackslashesForAnnotationParameters() { $this->mockReflectionService->expects($this->any())->method('getMethodParameters')->with('TheTargetType', '__construct')->will($this->returnValue([])); $this->mockReflectionService->expects($this->any())->method('hasMethod')->with('TheTargetType', 'setThePropertyName')->will($this->returnValue(false)); $this->mockReflectionService->expects($this->any())->method('getClassPropertyNames')->with('TheTargetType')->will($this->returnValue(['thePropertyName'])); $this->mockReflectionService->expects($this->any())->method('getPropertyTagValues')->with('TheTargetType', 'thePropertyName')->will($this->returnValue(['\\TheTypeOfSubObject'])); $configuration = new PropertyMappingConfiguration(); $configuration->setTypeConverterOptions(ObjectConverter::class, []); $this->assertEquals('TheTypeOfSubObject', $this->converter->getTypeOfChildProperty('TheTargetType', 'thePropertyName', $configuration)); }