@@ -69,19 +69,25 @@ public static function provideDateTimeFieldNames()
69
69
/**
70
70
* @dataProvider provideValidDateTimeFieldValues
71
71
*/
72
- public function testIsCastDateTimeFieldValueToDateTime ($ value , $ message )
72
+ public function testIsCastDateTimeFieldValueToDateTime ($ value , $ message, $ prettyDate = null )
73
73
{
74
74
$ graphNode = new GraphNode (['created_time ' => $ value ]);
75
75
76
76
$ this ->assertInstanceOf (\DateTime::class, $ graphNode ->getField ('created_time ' ), $ message );
77
+
78
+ if ($ prettyDate !== null ) {
79
+ $ this ->assertEquals ($ prettyDate , $ graphNode ->getField ('created_time ' )->format (\DateTime::RFC1036 ));
80
+ }
77
81
}
78
82
79
83
public static function provideValidDateTimeFieldValues ()
80
84
{
81
85
yield ['1985-10-26T01:21:00+0000 ' , 'Expected the valid ISO 8601 formatted date from Back To The Future to pass. ' ];
86
+ yield ['2014-07-15T03:44:53+0000 ' , 'Expected the valid ISO 8601 formatted date to pass. ' , 'Tue, 15 Jul 14 03:44:53 +0000 ' ];
82
87
yield ['1999-12-31 ' , 'Expected the valid ISO 8601 formatted date to party like it \'s 1999. ' ];
83
88
yield ['2009-05-19T14:39Z ' , 'Expected the valid ISO 8601 formatted date to pass. ' ];
84
89
yield ['2014-W36 ' , 'Expected the valid ISO 8601 formatted date to pass. ' ];
90
+ yield [1405547020 , 'Expected the valid timestamp to pass. ' , 'Wed, 16 Jul 14 23:43:40 +0200 ' ];
85
91
}
86
92
87
93
/**
@@ -100,32 +106,6 @@ public static function provideInvalidDateTimeFieldValues()
100
106
yield ['foo_time ' , 'Expected the invalid ISO 8601 format to fail. ' ];
101
107
}
102
108
103
- public function testATimeStampCanBeConvertedToADateTimeObject ()
104
- {
105
- $ someTimeStampFromGraph = 1405547020 ;
106
- $ graphNode = new GraphNode ();
107
- $ dateTime = $ graphNode ->castToDateTime ($ someTimeStampFromGraph );
108
- $ prettyDate = $ dateTime ->format (\DateTime::RFC1036 );
109
- $ timeStamp = $ dateTime ->getTimestamp ();
110
-
111
- $ this ->assertInstanceOf (\DateTime::class, $ dateTime );
112
- $ this ->assertEquals ('Wed, 16 Jul 14 23:43:40 +0200 ' , $ prettyDate );
113
- $ this ->assertEquals (1405547020 , $ timeStamp );
114
- }
115
-
116
- public function testAGraphDateStringCanBeConvertedToADateTimeObject ()
117
- {
118
- $ someDateStringFromGraph = '2014-07-15T03:44:53+0000 ' ;
119
- $ graphNode = new GraphNode ();
120
- $ dateTime = $ graphNode ->castToDateTime ($ someDateStringFromGraph );
121
- $ prettyDate = $ dateTime ->format (\DateTime::RFC1036 );
122
- $ timeStamp = $ dateTime ->getTimestamp ();
123
-
124
- $ this ->assertInstanceOf (\DateTime::class, $ dateTime );
125
- $ this ->assertEquals ('Tue, 15 Jul 14 03:44:53 +0000 ' , $ prettyDate );
126
- $ this ->assertEquals (1405395893 , $ timeStamp );
127
- }
128
-
129
109
public function testGettingGraphNodeAsAnArrayWillNotUncastTheDateTimeObject ()
130
110
{
131
111
$ graphNode = new GraphNode ([
0 commit comments