@@ -85,19 +85,23 @@ public function dateProvider()
8585 return [
8686 [
8787 'Articles/diffbot-sitepoint-basic.json ' ,
88- "Sun, 27 Jul 2014 00:00:00 GMT "
88+ "Sun, 27 Jul 2014 00:00:00 GMT " ,
89+ 2014
8990 ],
9091 [
9192 'Articles/diffbot-sitepoint-extended.json ' ,
92- "Sun, 27 Jul 2014 00:00:00 GMT "
93+ "Sun, 27 Jul 2014 00:00:00 GMT " ,
94+ 2014
9395 ],
9496 [
9597 'Articles/apple-watch-verge-basic.json ' ,
96- "Wed, 08 Apr 2015 00:00:00 GMT "
98+ "Wed, 08 Apr 2015 00:00:00 GMT " ,
99+ 2015
97100 ],
98101 [
99102 'Articles/apple-watch-verge-extended.json ' ,
100- "Wed, 08 Apr 2015 00:00:00 GMT "
103+ "Wed, 08 Apr 2015 00:00:00 GMT " ,
104+ 2015
101105 ]
102106 ];
103107 }
@@ -107,12 +111,15 @@ public function dateProvider()
107111 * @param $articles
108112 * @dataProvider dateProvider
109113 */
110- public function testDate ($ file , $ articles )
114+ public function testDate ($ file , $ articles, $ year )
111115 {
112116 $ articles = (is_array ($ articles )) ? $ articles : [$ articles ];
113117 /** @var Article $entity */
114118 foreach ($ this ->ei ($ file ) as $ i => $ entity ) {
115119 $ this ->assertEquals ($ articles [$ i ], $ entity ->getDate ());
120+ if (class_exists ('\Carbon\Carbon ' )) {
121+ $ this ->assertEquals ($ year , $ entity ->getDate ()->year );
122+ }
116123 }
117124 }
118125
@@ -351,7 +358,7 @@ public function testPublisherRegion($file, $value1)
351358 public function estimatedDateProvider ()
352359 {
353360 return [
354- ['Articles/15-11-07/diffbot-sitepoint-basic.json ' , 'Sun, 27 Jul 2014 00:00:00 GMT ' ],
361+ ['Articles/15-11-07/diffbot-sitepoint-basic.json ' , 'Sun, 27 Jul 2014 00:00:00 GMT ' , 2014 ],
355362 ];
356363 }
357364
@@ -360,12 +367,15 @@ public function estimatedDateProvider()
360367 * @param $file
361368 * @param $value1
362369 */
363- public function testEstimatedDate ($ file , $ value1 )
370+ public function testEstimatedDate ($ file , $ value1, $ value2 )
364371 {
365372 $ value1 = (is_array ($ value1 )) ? $ value1 : [$ value1 ];
366373 /** @var Article $entity */
367374 foreach ($ this ->ei ($ file ) as $ i => $ entity ) {
368375 $ this ->assertEquals ($ value1 [$ i ], $ entity ->getEstimatedDate ());
376+ if (class_exists ('\Carbon\Carbon ' )) {
377+ $ this ->assertEquals ($ value2 , $ entity ->getDate ()->year );
378+ }
369379 }
370380 }
371381
0 commit comments