From 1532124d23f67ce26896ef36ba90f1314f854997 Mon Sep 17 00:00:00 2001 From: Thomas Hernandez Date: Wed, 7 Mar 2018 16:11:07 -0500 Subject: [PATCH 1/2] Fixed timestamp format to truly follow ISO8601 (#155) * Fixed timestamp format to truly follow ISO8601 * Fixed unit tests to expect ISO8601 date format --- includes/classes/AmazonCore.php | 2 +- test-cases/includes/classes/AmazonFeedListTest.php | 4 ++-- test-cases/includes/classes/AmazonFinancialEventListTest.php | 4 ++-- test-cases/includes/classes/AmazonFinancialGroupListTest.php | 4 ++-- .../includes/classes/AmazonFulfillmentOrderCreatorTest.php | 4 ++-- .../includes/classes/AmazonFulfillmentOrderListTest.php | 2 +- test-cases/includes/classes/AmazonInventoryListTest.php | 2 +- test-cases/includes/classes/AmazonReportListTest.php | 4 ++-- test-cases/includes/classes/AmazonReportRequestListTest.php | 4 ++-- test-cases/includes/classes/AmazonReportRequestTest.php | 4 ++-- .../includes/classes/AmazonReportScheduleManagerTest.php | 4 ++-- test-cases/includes/classes/AmazonShipmentItemListTest.php | 4 ++-- test-cases/includes/classes/AmazonShipmentListTest.php | 4 ++-- 13 files changed, 23 insertions(+), 23 deletions(-) diff --git a/includes/classes/AmazonCore.php b/includes/classes/AmazonCore.php index 348d0c7a..068d7954 100644 --- a/includes/classes/AmazonCore.php +++ b/includes/classes/AmazonCore.php @@ -568,7 +568,7 @@ protected function genTime($time=false){ } else { throw new InvalidArgumentException('Invalid time input given'); } - return date('Y-m-d\TH:i:sO',$time-120); + return date('c', $time-120); } diff --git a/test-cases/includes/classes/AmazonFeedListTest.php b/test-cases/includes/classes/AmazonFeedListTest.php index c3d1c73e..a8f8226f 100644 --- a/test-cases/includes/classes/AmazonFeedListTest.php +++ b/test-cases/includes/classes/AmazonFeedListTest.php @@ -124,14 +124,14 @@ public function testSetTimeLimits($a, $b, $c, $d){ $o = $this->object->getOptions(); if ($c){ $this->assertArrayHasKey('SubmittedFromDate',$o); - $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i',$o['SubmittedFromDate']); + $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i:%i', $o['SubmittedFromDate']); } else { $this->assertArrayNotHasKey('SubmittedFromDate',$o); } if ($d){ $this->assertArrayHasKey('SubmittedToDate',$o); - $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i',$o['SubmittedToDate']); + $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i:%i', $o['SubmittedToDate']); } else { $this->assertArrayNotHasKey('SubmittedToDate',$o); } diff --git a/test-cases/includes/classes/AmazonFinancialEventListTest.php b/test-cases/includes/classes/AmazonFinancialEventListTest.php index 8480f6d1..18fcf6ba 100644 --- a/test-cases/includes/classes/AmazonFinancialEventListTest.php +++ b/test-cases/includes/classes/AmazonFinancialEventListTest.php @@ -60,7 +60,7 @@ public function testSetTimeLimits($a, $b, $c, $d){ if ($c) { $this->assertNull($try); $this->assertArrayHasKey('PostedAfter', $o); - $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i', $o['PostedAfter']); + $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i:%i', $o['PostedAfter']); $this->assertArrayNotHasKey('AmazonOrderId', $o); } else { $this->assertFalse($try); @@ -70,7 +70,7 @@ public function testSetTimeLimits($a, $b, $c, $d){ if ($c && $d) { $this->assertArrayHasKey('PostedBefore', $o); - $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i', $o['PostedBefore']); + $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i:%i', $o['PostedBefore']); //setting only first date resets second one $this->assertNull($this->object->setTimeLimits($a)); $o2 = $this->object->getOptions(); diff --git a/test-cases/includes/classes/AmazonFinancialGroupListTest.php b/test-cases/includes/classes/AmazonFinancialGroupListTest.php index 0323f9b0..9a8a376e 100644 --- a/test-cases/includes/classes/AmazonFinancialGroupListTest.php +++ b/test-cases/includes/classes/AmazonFinancialGroupListTest.php @@ -59,7 +59,7 @@ public function testSetTimeLimits($a, $b, $c, $d){ if ($c) { $this->assertNull($try); $this->assertArrayHasKey('FinancialEventGroupStartedAfter', $o); - $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i', $o['FinancialEventGroupStartedAfter']); + $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i:%i', $o['FinancialEventGroupStartedAfter']); } else { $this->assertFalse($try); $this->assertArrayNotHasKey('FinancialEventGroupStartedAfter', $o); @@ -67,7 +67,7 @@ public function testSetTimeLimits($a, $b, $c, $d){ if ($c && $d) { $this->assertArrayHasKey('FinancialEventGroupStartedBefore', $o); - $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i', $o['FinancialEventGroupStartedBefore']); + $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i:%i', $o['FinancialEventGroupStartedBefore']); //setting only first date resets second one $this->assertNull($this->object->setTimeLimits($a)); $o2 = $this->object->getOptions(); diff --git a/test-cases/includes/classes/AmazonFulfillmentOrderCreatorTest.php b/test-cases/includes/classes/AmazonFulfillmentOrderCreatorTest.php index 4eb55f7e..b7c5d0f6 100644 --- a/test-cases/includes/classes/AmazonFulfillmentOrderCreatorTest.php +++ b/test-cases/includes/classes/AmazonFulfillmentOrderCreatorTest.php @@ -291,9 +291,9 @@ public function testSetDeliveryWindow($a, $b, $c) { $o = $this->object->getOptions(); if ($c) { $this->assertArrayHasKey('DeliveryWindow.StartDateTime', $o); - $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i', $o['DeliveryWindow.StartDateTime']); + $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i:%i', $o['DeliveryWindow.StartDateTime']); $this->assertArrayHasKey('DeliveryWindow.EndDateTime', $o); - $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i', $o['DeliveryWindow.EndDateTime']); + $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i:%i', $o['DeliveryWindow.EndDateTime']); } else { $this->assertArrayNotHasKey('DeliveryWindow.StartDateTime', $o); $this->assertArrayNotHasKey('DeliveryWindow.EndDateTime', $o); diff --git a/test-cases/includes/classes/AmazonFulfillmentOrderListTest.php b/test-cases/includes/classes/AmazonFulfillmentOrderListTest.php index cc3f8b31..2533e941 100644 --- a/test-cases/includes/classes/AmazonFulfillmentOrderListTest.php +++ b/test-cases/includes/classes/AmazonFulfillmentOrderListTest.php @@ -33,7 +33,7 @@ public function testSetStartTime(){ $this->assertNull($this->object->setStartTime('-1 min')); $o = $this->object->getOptions(); $this->assertArrayHasKey('QueryStartDateTime',$o); - $this->assertNotEquals('1969-12-31T18:58:00-0500',$o['QueryStartDateTime']); + $this->assertNotEquals('1969-12-31T18:58:00-05:00', $o['QueryStartDateTime']); } public function testSetUseToken(){ diff --git a/test-cases/includes/classes/AmazonInventoryListTest.php b/test-cases/includes/classes/AmazonInventoryListTest.php index 5aa33a8e..ff5f69d4 100644 --- a/test-cases/includes/classes/AmazonInventoryListTest.php +++ b/test-cases/includes/classes/AmazonInventoryListTest.php @@ -41,7 +41,7 @@ public function testSetStartTime(){ $this->assertNull($this->object->setStartTime('-1 min')); $o = $this->object->getOptions(); $this->assertArrayHasKey('QueryStartDateTime',$o); - $this->assertNotEquals('1969-12-31T18:58:00-0500',$o['QueryStartDateTime']); + $this->assertNotEquals('1969-12-31T18:58:00-05:00', $o['QueryStartDateTime']); $this->assertArrayNotHasKey('SellerSkus.member.1',$o); } diff --git a/test-cases/includes/classes/AmazonReportListTest.php b/test-cases/includes/classes/AmazonReportListTest.php index caf8e543..a1eacf45 100644 --- a/test-cases/includes/classes/AmazonReportListTest.php +++ b/test-cases/includes/classes/AmazonReportListTest.php @@ -137,14 +137,14 @@ public function testSetTimeLimits($a, $b, $c, $d){ $o = $this->object->getOptions(); if ($c){ $this->assertArrayHasKey('AvailableFromDate',$o); - $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i',$o['AvailableFromDate']); + $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i:%i', $o['AvailableFromDate']); } else { $this->assertArrayNotHasKey('AvailableFromDate',$o); } if ($d){ $this->assertArrayHasKey('AvailableToDate',$o); - $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i',$o['AvailableToDate']); + $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i:%i', $o['AvailableToDate']); } else { $this->assertArrayNotHasKey('AvailableToDate',$o); } diff --git a/test-cases/includes/classes/AmazonReportRequestListTest.php b/test-cases/includes/classes/AmazonReportRequestListTest.php index 25af5d2d..fb6107de 100644 --- a/test-cases/includes/classes/AmazonReportRequestListTest.php +++ b/test-cases/includes/classes/AmazonReportRequestListTest.php @@ -149,14 +149,14 @@ public function testSetTimeLimits($a, $b, $c, $d){ $o = $this->object->getOptions(); if ($c){ $this->assertArrayHasKey('RequestedFromDate',$o); - $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i',$o['RequestedFromDate']); + $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i:%i', $o['RequestedFromDate']); } else { $this->assertArrayNotHasKey('RequestedFromDate',$o); } if ($d){ $this->assertArrayHasKey('RequestedToDate',$o); - $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i',$o['RequestedToDate']); + $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i:%i', $o['RequestedToDate']); } else { $this->assertArrayNotHasKey('RequestedToDate',$o); } diff --git a/test-cases/includes/classes/AmazonReportRequestTest.php b/test-cases/includes/classes/AmazonReportRequestTest.php index 39e32f60..6c84cb64 100644 --- a/test-cases/includes/classes/AmazonReportRequestTest.php +++ b/test-cases/includes/classes/AmazonReportRequestTest.php @@ -58,14 +58,14 @@ public function testSetTimeLimits($a, $b, $c, $d){ $o = $this->object->getOptions(); if ($c){ $this->assertArrayHasKey('StartDate',$o); - $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i',$o['StartDate']); + $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i:%i', $o['StartDate']); } else { $this->assertArrayNotHasKey('StartDate',$o); } if ($d){ $this->assertArrayHasKey('EndDate',$o); - $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i',$o['EndDate']); + $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i:%i', $o['EndDate']); } else { $this->assertArrayNotHasKey('EndDate',$o); } diff --git a/test-cases/includes/classes/AmazonReportScheduleManagerTest.php b/test-cases/includes/classes/AmazonReportScheduleManagerTest.php index 0a5e5e05..a2cff244 100644 --- a/test-cases/includes/classes/AmazonReportScheduleManagerTest.php +++ b/test-cases/includes/classes/AmazonReportScheduleManagerTest.php @@ -51,8 +51,8 @@ public function testSetScheduledDate(){ $this->assertNull($this->object->setScheduledDate('-1 min')); $o = $this->object->getOptions(); $this->assertArrayHasKey('ScheduledDate',$o); - $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i',$o['ScheduledDate']); - $this->assertNotEquals('1969-12-31T18:58:00-0500',$o['ScheduledDate']); + $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i:%i', $o['ScheduledDate']); + $this->assertNotEquals('1969-12-31T18:58:00-05:00', $o['ScheduledDate']); } public function testManageReportSchedule(){ diff --git a/test-cases/includes/classes/AmazonShipmentItemListTest.php b/test-cases/includes/classes/AmazonShipmentItemListTest.php index 04af0dfb..aa589ece 100644 --- a/test-cases/includes/classes/AmazonShipmentItemListTest.php +++ b/test-cases/includes/classes/AmazonShipmentItemListTest.php @@ -73,9 +73,9 @@ public function testSetTimeLimits($a, $b){ $this->object->setTimeLimits($a,$b); $o = $this->object->getOptions(); $this->assertArrayHasKey('LastUpdatedAfter',$o); - $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i',$o['LastUpdatedAfter']); + $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i:%i', $o['LastUpdatedAfter']); $this->assertArrayHasKey('LastUpdatedBefore',$o); - $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i',$o['LastUpdatedBefore']); + $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i:%i', $o['LastUpdatedBefore']); } public function testResetTimeLimit(){ diff --git a/test-cases/includes/classes/AmazonShipmentListTest.php b/test-cases/includes/classes/AmazonShipmentListTest.php index ce609da9..9eb3549e 100644 --- a/test-cases/includes/classes/AmazonShipmentListTest.php +++ b/test-cases/includes/classes/AmazonShipmentListTest.php @@ -88,9 +88,9 @@ public function testSetTimeLimits($a, $b){ $this->object->setTimeLimits($a,$b); $o = $this->object->getOptions(); $this->assertArrayHasKey('LastUpdatedAfter',$o); - $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i',$o['LastUpdatedAfter']); + $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i:%i', $o['LastUpdatedAfter']); $this->assertArrayHasKey('LastUpdatedBefore',$o); - $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i',$o['LastUpdatedBefore']); + $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i:%i', $o['LastUpdatedBefore']); } public function testResetTimeLimit(){ From cb8f5c906d3e93b93e23ed591ae2f262db2e33af Mon Sep 17 00:00:00 2001 From: Thomas Hernandez Date: Wed, 7 Mar 2018 16:15:57 -0500 Subject: [PATCH 2/2] Updated change log with 1.4.2 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c11d32e..23f8c9d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## 1.4.2 - 2018-03-07 +### Changed + - Fixed timestamp to fully comply with ISO8601 standard + ## 1.4.1 - 2018-01-19 ### Changed - Fixed parameter names for Product Fees Estimates