transform() public method

Transforms a DateTime object into a date string with the configured format and timezone
public transform ( DateTime $value ) : string
$value DateTime A DateTime object
return string A value as produced by PHP's date() function
 public function testTransformExpectsDateTime()
 {
     $transformer = new DateTimeToStringTransformer();
     $this->setExpectedException('Symfony\\Component\\Form\\Exception\\UnexpectedTypeException');
     $transformer->transform('1234');
 }
 public function testTransformExpectsDateTime()
 {
     $transformer = new DateTimeToStringTransformer();
     $this->setExpectedException('\\InvalidArgumentException');
     $transformer->transform('1234');
 }