8000 Added tests for string fix in DateTimeToArrayTransformer (8351a112861… · symfony/symfony@2582fcb · GitHub
[go: up one dir, main page]

Skip to content

Commit 2582fcb

Browse files
committed
Added tests for string fix in DateTimeToArrayTransformer (8351a11).
1 parent 8351a11 commit 2582fcb

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

tests/Symfony/Tests/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,4 +463,52 @@ public function testReverseTransformWithInvalidDay()
463463
'second' => '6',
464464
));
465465
}
466+
467+
/**
468+
* @expectedException Symfony\Component\Form\Exception\TransformationFailedException
469+
*/
470+
public function testReverseTransformWithStringDay()
471+
{
472+
$transformer = new DateTimeToArrayTransformer();
473+
$transformer->reverseTransform(array(
474+
'year' => '2010',
475+
'month' => '2',
476+
'day' => 'bazinga',
477+
'hour' => '4',
478+
'minute' => '5',
479+
'second' => '6',
480+
));
481+
}
482+
483+
/**
484+
* @expectedException Symfony\Component\Form\Exception\TransformationFailedException
485+
*/
486+
public function testReverseTransformWithStringMonth()
487+
{
488+
$transformer = new DateTimeToArrayTransformer();
489+
$transformer->reverseTransform(array(
490+
'year' => '2010',
491+
'month' => 'bazinga',
492+
'day' => '31',
493+
'hour' => '4',
494+
'minute' => '5',
495+
'second' => '6',
496+
));
497+
}
498+
499+
/**
500+
* @expectedException Symfony\Component\Form\Exception\TransformationFailedException
501+
*/
502+
public function testReverseTransformWithStringYear()
503+
{
504+
$transformer = new DateTimeToArrayTransformer();
505+
$transformer->reverseTransform(array(
506+
'year' => 'bazinga',
507+
'month' => '2',
508+
'day' => '31',
509+
'hour' => '4',
510+
'minute' => '5',
511+
'second' => '6',
512+
));
513+
}
466514
}

0 commit comments

Comments
 (0)
0