File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed
src/FreeElephants/JsonApi/DTO/Field
tests/FreeElephants/JsonApi/DTO Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change 55
66class DateTimeFieldValue extends \DateTime implements \JsonSerializable
77{
8- public const DEFAULT_JSONAPI_DATE_FORMAT = 'Y-m-d\TH:i:s.vp ' ;
8+ public const DEFAULT_JSONAPI_DATE_FORMAT = 'Y-m-d\TH:i:s.vP ' ;
99 private static string $ format = self ::DEFAULT_JSONAPI_DATE_FORMAT ;
1010
1111 public static function setFormat (string $ format )
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ public function testFromRequest()
1818 "type": "foo",
1919 "attributes": {
2020 "foo": "bar",
21- "date": "2012-04-23T18:25:43.511Z ",
21+ "date": "2012-04-23T18:25:43.511+03:00 ",
2222 "nested": {
2323 "someNestedStructure": {
2424 "someKey": "someValue"
@@ -39,16 +39,15 @@ public function testFromRequest()
3939 }
4040}
4141JSON ;
42- $ request ->getBody ()->write ($ rawJson
43- );
42+ $ request ->getBody ()->write ($ rawJson );
4443
4544 $ fooDTO = FooDocument::fromHttpMessage ($ request );
4645
4746 $ this ->assertInstanceOf (FooResource::class, $ fooDTO ->data );
4847 $ this ->assertInstanceOf (FooAttributes::class, $ fooDTO ->data ->attributes );
4948 $ this ->assertSame ('foo ' , $ fooDTO ->data ->type );
5049 $ this ->assertSame ('bar ' , $ fooDTO ->data ->attributes ->foo );
51- $ this ->assertEquals (new \DateTime ('2012-04-23T18:25:43.511Z ' ), $ fooDTO ->data ->attributes ->date );
50+ $ this ->assertEquals (new \DateTime ('2012-04-23T18:25:43.511+03 ' ), $ fooDTO ->data ->attributes ->date );
5251 $ this ->assertSame ('someValue ' , $ fooDTO ->data ->attributes ->nested ->someNestedStructure ->someKey );
5352 $ this ->assertSame ('baz-id ' , $ fooDTO ->data ->relationships ->baz ->data ->id );
5453 $ this ->assertNull ($ fooDTO ->data ->attributes ->nullableObjectField );
You can’t perform that action at this time.
0 commit comments