コード例 #1
0
ファイル: ObjectConverterTest.php プロジェクト: nxpthx/FLOW3
 /**
  * @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))));
     $configuration = new \TYPO3\FLOW3\Property\PropertyMappingConfiguration();
     $configuration->setTypeConverterOptions('TYPO3\\FLOW3\\Property\\TypeConverter\\ObjectConverter', array());
     $this->assertEquals('TheTypeOfSubObject', $this->converter->getTypeOfChildProperty('TheTargetType', 'thePropertyName', $configuration));
 }
コード例 #2
0
 /**
  * @param array $typeConverterOptions
  * @return \TYPO3\FLOW3\Property\PropertyMappingConfiguration
  */
 protected function buildConfiguration($typeConverterOptions)
 {
     $configuration = new \TYPO3\FLOW3\Property\PropertyMappingConfiguration();
     $configuration->setTypeConverterOptions('TYPO3\\FLOW3\\Property\\TypeConverter\\PersistentObjectConverter', $typeConverterOptions);
     return $configuration;
 }
コード例 #3
0
ファイル: FloatConverterTest.php プロジェクト: nxpthx/FLOW3
 /**
  * @test
  * @expectedException TYPO3\FLOW3\I18n\Exception\InvalidLocaleIdentifierException
  */
 public function convertFromThrowsExceptionIfLocaleIsInvalid()
 {
     $configuration = new \TYPO3\FLOW3\Property\PropertyMappingConfiguration();
     $configuration->setTypeConverterOption('TYPO3\\FLOW3\\Property\\TypeConverter\\FloatConverter', 'locale', 'some-non-existent-locale-identifier');
     $this->converter->convertFrom('84,42', 'float', array(), $configuration);
 }
コード例 #4
0
 /**
  * @test
  */
 public function convertFromProperlyConvertsArrayWithDateAsArray()
 {
     $source = array('day' => '13', 'month' => '10', 'year' => '2010');
     $mappingConfiguration = new \TYPO3\FLOW3\Property\PropertyMappingConfiguration();
     $mappingConfiguration->setTypeConverterOption('TYPO3\\FLOW3\\Property\\TypeConverter\\DateTimeConverter', \TYPO3\FLOW3\Property\TypeConverter\DateTimeConverter::CONFIGURATION_DATE_FORMAT, 'Y-m-d');
     $date = $this->converter->convertFrom($source, 'DateTime', array(), $mappingConfiguration);
     $actualResult = $date->format('Y-m-d');
     $this->assertSame('2010-10-13', $actualResult);
 }