/** * @test * @dataProvider arrayToStringDataProvider */ public function canConvertFromStringToArray($source, $expectedResult, $mappingConfiguration) { // Create a map of arguments to return values. $configurationValueMap = array(); foreach ($mappingConfiguration as $setting => $value) { $configurationValueMap[] = array('TYPO3\\Flow\\Property\\TypeConverter\\StringConverter', $setting, $value); } $propertyMappingConfiguration = $this->getMock('\\TYPO3\\Flow\\Property\\PropertyMappingConfiguration'); $propertyMappingConfiguration->expects($this->any())->method('getConfigurationValue')->will($this->returnValueMap($configurationValueMap)); $this->assertEquals($expectedResult, $this->converter->convertFrom($source, 'array', array(), $propertyMappingConfiguration)); }
/** * @test */ public function getSourceChildPropertiesToBeConvertedShouldReturnEmptyArray() { $this->assertEmpty($this->converter->getSourceChildPropertiesToBeConverted('something')); }
/** * @test */ public function getSourceChildPropertiesToBeConvertedShouldReturnEmptyArray() { $this->assertEquals(array(), $this->converter->getSourceChildPropertiesToBeConverted('myString')); }
/** * @test */ public function convertFromShouldReturnNullForEmptyString() { $source = ''; $result = $this->converter->convertFrom($source, 'TYPO3\\Flow\\Fixtures\\ClassWithSettersAndConstructor'); $this->assertNull($result); }