@@ -363,8 +363,11 @@ public function testGetTrackingErrorResponse()
363
363
364
364
/**
365
365
* @covers \Magento\Fedex\Model\Carrier::getTracking
366
+ * @param string $shipTimestamp
367
+ * @param string $expectedDate
368
+ * @dataProvider shipDateDataProvider
366
369
*/
367
- public function testGetTracking ()
370
+ public function testGetTracking ($ shipTimestamp , $ expectedDate )
368
371
{
369
372
$ tracking = '123456789012 ' ;
370
373
@@ -374,7 +377,7 @@ public function testGetTracking()
374
377
$ response ->CompletedTrackDetails = new \stdClass ();
375
378
376
379
$ trackDetails = new \stdClass ();
377
- $ trackDetails ->ShipTimestamp = ' 2016-08-05T14:06:35+00:00 ' ;
380
+ $ trackDetails ->ShipTimestamp = $ shipTimestamp ;
378
381
$ trackDetails ->DeliverySignatureName = 'signature ' ;
379
382
380
383
$ trackDetails ->StatusDetail = new \stdClass ();
@@ -414,7 +417,6 @@ public function testGetTracking()
414
417
'signedby ' ,
415
418
'status ' ,
416
419
'service ' ,
417
- 'shippeddate ' ,
418
420
'deliverydate ' ,
419
421
'deliverytime ' ,
420
422
'deliverylocation ' ,
@@ -426,7 +428,23 @@ public function testGetTracking()
426
428
427
429
static ::assertEquals ('2016-08-10 ' , $ current ['deliverydate ' ]);
428
430
static ::assertEquals ('10:20:26 ' , $ current ['deliverytime ' ]);
429
- static ::assertEquals ('2016-08-05 ' , $ current ['shippeddate ' ]);
431
+ static ::assertEquals ($ expectedDate , $ current ['shippeddate ' ]);
432
+ }
433
+
434
+ /**
435
+ * Get list of variations for testing ship date
436
+ * @return array
437
+ */
438
+ public function shipDateDataProvider ()
439
+ {
440
+ return [
441
+ ['shipTimestamp ' => '2016-08-05T14:06:35+00:00 ' , 'expectedDate ' => '2016-08-05 ' ],
442
+ ['shipTimestamp ' => '2016-08-05T14:06:35 ' , 'expectedDate ' => null ],
443
+ ['shipTimestamp ' => '2016-08-05 14:06:35 ' , 'expectedDate ' => null ],
444
+ ['shipTimestamp ' => '2016-08-05 14:06:35+00:00 ' , 'expectedDate ' => null ],
445
+ ['shipTimestamp ' => '2016-08-05 ' , 'expectedDate ' => null ],
446
+ ['shipTimestamp ' => '2016/08/05 ' , 'expectedDate ' => null ],
447
+ ];
430
448
}
431
449
432
450
/**
0 commit comments