Example #1
0
 /**
  * @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);
 }
Example #2
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);
 }