38 $this->propertyMappingConfiguration = new \TYPO3\CMS\Extbase\Property\PropertyMappingConfiguration();
46 $this->assertEquals(
'someSourceProperty', $this->propertyMappingConfiguration->getTargetPropertyName(
'someSourceProperty'));
47 $this->assertEquals(
'someOtherSourceProperty', $this->propertyMappingConfiguration->getTargetPropertyName(
'someOtherSourceProperty'));
55 $this->assertFalse($this->propertyMappingConfiguration->shouldMap(
'someSourceProperty'));
56 $this->assertFalse($this->propertyMappingConfiguration->shouldMap(
'someOtherSourceProperty'));
64 $this->propertyMappingConfiguration->allowAllProperties();
65 $this->assertTrue($this->propertyMappingConfiguration->shouldMap(
'someSourceProperty'));
66 $this->assertTrue($this->propertyMappingConfiguration->shouldMap(
'someOtherSourceProperty'));
74 $this->propertyMappingConfiguration->allowProperties(
'someSourceProperty',
'someOtherProperty');
75 $this->assertTrue($this->propertyMappingConfiguration->shouldMap(
'someSourceProperty'));
76 $this->assertTrue($this->propertyMappingConfiguration->shouldMap(
'someOtherProperty'));
84 $this->propertyMappingConfiguration->allowAllPropertiesExcept(
'someSourceProperty',
'someOtherProperty');
85 $this->assertFalse($this->propertyMappingConfiguration->shouldMap(
'someSourceProperty'));
86 $this->assertFalse($this->propertyMappingConfiguration->shouldMap(
'someOtherProperty'));
88 $this->assertTrue($this->propertyMappingConfiguration->shouldMap(
'someOtherPropertyWhichHasNotBeenConfigured'));
96 $this->assertFalse($this->propertyMappingConfiguration->shouldSkip(
'someSourceProperty'));
97 $this->assertFalse($this->propertyMappingConfiguration->shouldSkip(
'someOtherSourceProperty'));
105 $this->propertyMappingConfiguration->skipProperties(
'someSourceProperty',
'someOtherSourceProperty');
106 $this->assertTrue($this->propertyMappingConfiguration->shouldSkip(
'someSourceProperty'));
107 $this->assertTrue($this->propertyMappingConfiguration->shouldSkip(
'someOtherSourceProperty'));
114 $mockTypeConverterClass = $this->getMockClass(
'TYPO3\CMS\Extbase\Property\TypeConverterInterface');
116 $this->propertyMappingConfiguration->setTypeConverterOptions($mockTypeConverterClass, array(
'k1' =>
'v1',
'k2' =>
'v2'));
117 $this->assertEquals(
'v1', $this->propertyMappingConfiguration->getConfigurationValue($mockTypeConverterClass,
'k1'));
118 $this->assertEquals(
'v2', $this->propertyMappingConfiguration->getConfigurationValue($mockTypeConverterClass,
'k2'));
125 $this->assertNull($this->propertyMappingConfiguration->getConfigurationValue(
'foo',
'bar'));
132 $mockTypeConverterClass = $this->getMockClass(
'TYPO3\CMS\Extbase\Property\TypeConverterInterface');
133 $this->propertyMappingConfiguration->setTypeConverterOptions($mockTypeConverterClass, array(
'k1' =>
'v1',
'k2' =>
'v2'));
134 $this->propertyMappingConfiguration->setTypeConverterOptions($mockTypeConverterClass, array(
'k3' =>
'v3'));
136 $this->assertEquals(
'v3', $this->propertyMappingConfiguration->getConfigurationValue($mockTypeConverterClass,
'k3'));
137 $this->assertNull($this->propertyMappingConfiguration->getConfigurationValue($mockTypeConverterClass,
'k2'));
144 $mockTypeConverterClass = $this->getMockClass(
'TYPO3\CMS\Extbase\Property\TypeConverterInterface');
145 $this->propertyMappingConfiguration->setTypeConverterOptions($mockTypeConverterClass, array(
'k1' =>
'v1',
'k2' =>
'v2'));
146 $this->propertyMappingConfiguration->setTypeConverterOption($mockTypeConverterClass,
'k1',
'v3');
148 $this->assertEquals(
'v3', $this->propertyMappingConfiguration->getConfigurationValue($mockTypeConverterClass,
'k1'));
149 $this->assertEquals(
'v2', $this->propertyMappingConfiguration->getConfigurationValue($mockTypeConverterClass,
'k2'));
156 $this->assertNull($this->propertyMappingConfiguration->getTypeConverter());
163 $mockTypeConverter = $this->getMock(
'TYPO3\\CMS\\Extbase\\Property\\TypeConverterInterface');
164 $this->propertyMappingConfiguration->setTypeConverter($mockTypeConverter);
165 $this->assertSame($mockTypeConverter, $this->propertyMappingConfiguration->getTypeConverter());
172 $childConfiguration = $this->propertyMappingConfiguration->forProperty(
'key1.key2');
173 $childConfiguration->setTypeConverterOption(
'someConverter',
'foo',
'specialChildConverter');
175 return $childConfiguration;
182 $this->propertyMappingConfiguration->setMapping(
'k1',
'k1a');
183 $this->assertEquals(
'k1a', $this->propertyMappingConfiguration->getTargetPropertyName(
'k1'));
184 $this->assertEquals(
'k2', $this->propertyMappingConfiguration->getTargetPropertyName(
'k2'));
191 $mockTypeConverterClass = $this->getMockClass(
'TYPO3\CMS\Extbase\Property\TypeConverterInterface');
194 array(
'allowAllProperties'),
195 array(
'allowProperties'),
196 array(
'allowAllPropertiesExcept'),
197 array(
'setMapping', array(
'k1',
'k1a')),
198 array(
'setTypeConverterOptions', array($mockTypeConverterClass, array(
'k1' =>
'v1',
'k2' =>
'v2'))),
199 array(
'setTypeConverterOption', array($mockTypeConverterClass,
'k1',
'v3')),
200 array(
'setTypeConverter', array($this->getMock(
'TYPO3\CMS\Extbase\Property\TypeConverterInterface'))),
209 $actualResult = call_user_func_array(array($this->propertyMappingConfiguration, $methodToTestForFluentInterface), $argumentsForMethod);
210 $this->assertSame($this->propertyMappingConfiguration, $actualResult);
218 $this->propertyMappingConfiguration->forProperty(
'items.*')->setTypeConverterOptions(
'stdClass', array(
'k1' =>
'v1'));
220 $configuration = $this->propertyMappingConfiguration->getConfigurationFor(
'items')->getConfigurationFor(
'6');
221 $this->assertSame(
'v1', $configuration->getConfigurationValue(
'stdClass',
'k1'));
229 $this->propertyMappingConfiguration->forProperty(
'items.*.foo')->setTypeConverterOptions(
'stdClass', array(
'k1' =>
'v1'));
231 $configuration = $this->propertyMappingConfiguration->forProperty(
'items.6.foo');
232 $this->assertSame(
'v1', $configuration->getConfigurationValue(
'stdClass',
'k1'));
239 $this->propertyMappingConfiguration->forProperty(
'items.*')->setTypeConverterOptions(
'stdClass', array(
'k1' =>
'v1'));
241 $configuration = $this->propertyMappingConfiguration->forProperty(
'items');
242 $this->assertTrue($configuration->shouldMap(6));
setTypeConverterOptionsCanBeRetrievedAgain()
getTargetPropertyNameShouldReturnTheUnmodifiedPropertyNameWithoutConfiguration()
shouldSkipReturnsFalseByDefault()
respectiveMethodsProvideFluentInterface($methodToTestForFluentInterface, array $argumentsForMethod=array())
shouldMapReturnsFalseForBlacklistedProperties()
forPropertyWithAsteriskAllowsArbitraryPropertyNamesWithGetConfigurationFor()
shouldMapReturnsTrueForAllowedProperties()
setTypeConverterOptionsShouldOverrideAlreadySetOptions()
nonexistentTypeConverterOptionsReturnNull()
forPropertyWithAsteriskAllowsArbitraryPropertyNamesWithForProperty()
getTypeConverterReturnsNullIfNoTypeConverterSet()
buildChildConfigurationForSingleProperty()
$propertyMappingConfiguration
forPropertyWithAsteriskAllowsArbitraryPropertyNamesWithShouldMap()
setTypeConverterOptionShouldOverrideAlreadySetOptions()
shouldMapReturnsTrueIfConfigured()
getTypeConverterReturnsTypeConverterIfItHasBeenSet()
shouldSkipReturnsTrueIfConfigured()
fluentInterfaceMethodsDataProvider()
shouldMapReturnsFalseByDefault()
getTargetPropertyNameShouldRespectMapping()