@@ -41,12 +41,12 @@ public function testNormalize()
4141$ this ->assertEquals ('2016-01-01T00:00:00+00:00 ' ,$ this ->normalizer ->normalize (new \DateTimeImmutable ('2016/01/01 ' ,new \DateTimeZone ('UTC ' ))));
4242 }
4343
44- public function testContextFormat ()
44+ public function testNormalizeUsingFormatPassedInContext ()
4545 {
4646$ this ->assertEquals ('2016 ' ,$ this ->normalizer ->normalize (new \DateTime ('2016/01/01 ' ),null ,array (DateTimeNormalizer::FORMAT_KEY =>'Y ' )));
4747 }
4848
49- public function testConstructorFormat ()
49+ public function testNormalizeUsingFormatPassedInConstructor ()
5050 {
5151$ this ->assertEquals ('16 ' , (new DateTimeNormalizer ('y ' ))->normalize (new \DateTime ('2016/01/01 ' ,new \DateTimeZone ('UTC ' ))));
5252 }
@@ -55,7 +55,7 @@ public function testConstructorFormat()
5555 * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
5656 * @expectedExceptionMessage The object must implement the "\DateTimeInterface".
5757 */
58- public function testInvalidDataThrowException ()
58+ public function testNormalizeInvalidObjectThrowsException ()
5959 {
6060$ this ->normalizer ->normalize (new \stdClass ());
6161 }
@@ -75,10 +75,17 @@ public function testDenormalize()
7575$ this ->assertEquals (new \DateTime ('2016/01/01 ' ,new \DateTimeZone ('UTC ' )),$ this ->normalizer ->denormalize ('2016-01-01T00:00:00+00:00 ' , \DateTime::class));
7676 }
7777
78+ public function testDenormalizeUsingFormatPassedInContext ()
79+ {
80+ $ this ->assertEquals (new \DateTimeImmutable ('2016/01/01 ' ,new \DateTimeZone ('UTC ' )),$ this ->normalizer ->denormalize ('2016.01.01 ' , \DateTimeInterface::class,null ,array (DateTimeNormalizer::FORMAT_KEY =>'Y.m.d| ' )));
81+ $ this ->assertEquals (new \DateTimeImmutable ('2016/01/01 ' ,new \DateTimeZone ('UTC ' )),$ this ->normalizer ->denormalize ('2016.01.01 ' , \DateTimeImmutable::class,null ,array (DateTimeNormalizer::FORMAT_KEY =>'Y.m.d| ' )));
82+ $ this ->assertEquals (new \DateTime ('2016/01/01 ' ,new \DateTimeZone ('UTC ' )),$ this ->normalizer ->denormalize ('2016.01.01 ' , \DateTime::class,null ,array (DateTimeNormalizer::FORMAT_KEY =>'Y.m.d| ' )));
83+ }
84+
7885/**
7986 * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
8087 */
81- public function testInvalidDateThrowException ()
88+ public function testDenormalizeInvalidDataThrowsException ()
8289 {
8390$ this ->normalizer ->denormalize ('invalid date ' , \DateTimeInterface::class);
8491 }