diff --git a/docs/Managers/GlobalOrderManager.md b/docs/Managers/GlobalOrderManager.md index 61b7b50..f5193ac 100644 --- a/docs/Managers/GlobalOrderManager.md +++ b/docs/Managers/GlobalOrderManager.md @@ -82,6 +82,7 @@ This method provides you the possibility to use the most common parameters in on | `$offset` | int | Number of orders to skip at the beginning of the list. | No | 0 | | `$sortBy` | string | Allows choosing the sorting column. The possible values are created_at and updated_at. | No | created_at | | `$sortDirection` | string | Specify the sort type. The possible are values (ASC, DESC). | No | ASC | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | #### Example @@ -105,6 +106,7 @@ This method returns the orders created between two specified dates. | `$offset` | int | Number of orders to skip at the beginning of the list. | No | 0 | | `$sortBy` | string | Allows choosing the sorting column. The possible values are created_at and updated_at. | No | created_at | | `$sortDirection` | string | Specify the sort type. The possible are values (ASC, DESC). | No | ASC | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | #### Example @@ -133,6 +135,7 @@ This method returns the orders between the two specified dates. | `$offset` | int | Number of orders to skip at the beginning of the list. | No | 0 | | `$sortBy` | string | Allows choosing the sorting column. The possible values are created_at and updated_at. | No | created_at | | `$sortDirection` | string | Specify the sort type. The possible are values (ASC, DESC). | No | ASC | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | #### Example @@ -157,6 +160,7 @@ This method returns the orders created after the specified date. | `$offset` | int | Number of orders to skip at the beginning of the list. | No | 0 | | `$sortBy` | string | Allows choosing the sorting column. The possible values are created_at and updated_at. | No | created_at | | `$sortDirection` | string | Specify the sort type. The possible are values (ASC, DESC). | No | ASC | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | #### Example @@ -183,6 +187,7 @@ This method returns the orders created before the specified date. | `$offset` | int | Number of orders to skip at the beginning of the list. | No | 0 | | `$sortBy` | string | Allows choosing the sorting column. The possible values are created_at and updated_at. | No | created_at | | `$sortDirection` | string | Specify the sort type. The possible are values (ASC, DESC). | No | ASC | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | #### Example @@ -207,6 +212,7 @@ This method returns the orders updated after the specified date. | `$offset` | int | Number of orders to skip at the beginning of the list. | No | 0 | | `$sortBy` | string | Allows choosing the sorting column. The possible values are created_at and updated_at. | No | created_at | | `$sortDirection` | string | Specify the sort type. The possible are values (ASC, DESC). | No | ASC | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | #### Example @@ -231,6 +237,7 @@ This method returns the orders updated before the specified date. | `$offset` | int | Number of orders to skip at the beginning of the list. | No | 0 | | `$sortBy` | string | Allows choosing the sorting column. The possible values are created_at and updated_at. | No | created_at | | `$sortDirection` | string | Specify the sort type. The possible are values (ASC, DESC). | No | ASC | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | #### Example diff --git a/docs/Managers/GlobalProductManager.md b/docs/Managers/GlobalProductManager.md index 9b94c29..84dc1c1 100644 --- a/docs/Managers/GlobalProductManager.md +++ b/docs/Managers/GlobalProductManager.md @@ -61,6 +61,7 @@ Provides you the possibility to use the most common parameters in one call. | `$skuSellerList` | array | Array of strings representing multiple sellers SKUs | No | - | | `$updatedAfter` | DateTimeInterface | Filters the products using the specified date. The date provided will be included in the filter. | No | - | | `$updatedBefore` | DateTimeInterface | Filters the products using the specified date. The date provided will be included in the filter. | No | - | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | @@ -127,6 +128,7 @@ Returns the products created after the specified date. | `$createdAfter` | DateTimeInterface | Filters the products using the specified date. | Yes | - | | `$limit` | integer | The maximum number of products that could be returned | No | 1000 | | `$offset` | integer | Number of products to skip at the beginning of the list. | No | 0 | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | @@ -151,6 +153,7 @@ Returns products created before the specified date. | `$createdBefore` | | Filters the products using the specified date | Yes | - | | `$limit` | integer | The maximum number of products that could be returned | No | 1000 | | `$offset` | integer | Number of products to skip at the beginning of the list. | No | 0 | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | @@ -174,6 +177,7 @@ Returns products updated after the specified date. | $updatedAfter | DateTimeInterface | Filters the products using the specified date. The date provided will be included in the filter. | Yes | - | | $limit | integer | The maximum number of products that could be returned | No | 1000 | | $offset | integer | Number of products to skip at the beginning of the list. | No | 0 | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | @@ -197,6 +201,7 @@ Returns products updated before the specified date. | $updatedBefore | DateTimeInterface | Filters the products using the specified date. The date provided will be included in the filter. | No | - | | $limit | integer | The maximum number of products that could be returned | No | 1000 | | $offset | integer | Number of products to skip at the beginning of the list. | No | 0 | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | diff --git a/docs/Managers/OrderManager.md b/docs/Managers/OrderManager.md index d00d8ab..dcfd934 100644 --- a/docs/Managers/OrderManager.md +++ b/docs/Managers/OrderManager.md @@ -80,6 +80,7 @@ This method provides you the possibility to use the most common parameters in on | `$offset` | int | Number of orders to skip at the beginning of the list. | No | 0 | | `$sortBy` | string | Allows choosing the sorting column. The possible values are created_at and updated_at. | No | created_at | | `$sortDirection` | string | Specify the sort type. The possible are values (ASC, DESC). | No | ASC | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | #### Example @@ -103,6 +104,7 @@ This method returns the orders created between two specified dates. | `$offset` | int | Number of orders to skip at the beginning of the list. | No | 0 | | `$sortBy` | string | Allows choosing the sorting column. The possible values are created_at and updated_at. | No | created_at | | `$sortDirection` | string | Specify the sort type. The possible are values (ASC, DESC). | No | ASC | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | #### Example @@ -130,7 +132,8 @@ This method returns the orders between the two specified dates. | `$limit` | int | The maximum number of orders that could be returned. | No | 1000 | | `$offset` | int | Number of orders to skip at the beginning of the list. | No | 0 | | `$sortBy` | string | Allows choosing the sorting column. The possible values are created_at and updated_at. | No | created_at | -| `$sortDirection` | string | Specify the sort type. The possible are values (ASC, DESC). | No | ASC | +| `$sortDirection` | string | Specify the sort type. The possible are values (ASC, DESC). | No | ASC |รง +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | #### Example @@ -155,6 +158,7 @@ This method returns the orders created after the specified date. | `$offset` | int | Number of orders to skip at the beginning of the list. | No | 0 | | `$sortBy` | string | Allows choosing the sorting column. The possible values are created_at and updated_at. | No | created_at | | `$sortDirection` | string | Specify the sort type. The possible are values (ASC, DESC). | No | ASC | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | #### Example @@ -181,6 +185,7 @@ This method returns the orders created before the specified date. | `$offset` | int | Number of orders to skip at the beginning of the list. | No | 0 | | `$sortBy` | string | Allows choosing the sorting column. The possible values are created_at and updated_at. | No | created_at | | `$sortDirection` | string | Specify the sort type. The possible are values (ASC, DESC). | No | ASC | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | #### Example @@ -205,6 +210,7 @@ This method returns the orders updated after the specified date. | `$offset` | int | Number of orders to skip at the beginning of the list. | No | 0 | | `$sortBy` | string | Allows choosing the sorting column. The possible values are created_at and updated_at. | No | created_at | | `$sortDirection` | string | Specify the sort type. The possible are values (ASC, DESC). | No | ASC | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | #### Example @@ -229,6 +235,7 @@ This method returns the orders updated before the specified date. | `$offset` | int | Number of orders to skip at the beginning of the list. | No | 0 | | `$sortBy` | string | Allows choosing the sorting column. The possible values are created_at and updated_at. | No | created_at | | `$sortDirection` | string | Specify the sort type. The possible are values (ASC, DESC). | No | ASC | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | #### Example diff --git a/docs/Managers/ProductManager.md b/docs/Managers/ProductManager.md index b26da98..4afdb36 100644 --- a/docs/Managers/ProductManager.md +++ b/docs/Managers/ProductManager.md @@ -61,6 +61,7 @@ Provides you the possibility to use the most common parameters in one call. | `$skuSellerList` | array | Array of strings representing multiple sellers SKUs | No | - | | `$updatedAfter` | DateTimeInterface | Filters the products using the specified date. The date provided will be included in the filter. | No | - | | `$updatedBefore` | DateTimeInterface | Filters the products using the specified date. The date provided will be included in the filter. | No | - | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | @@ -127,6 +128,7 @@ Returns the products created after the specified date. | `$createdAfter` | DateTimeInterface | Filters the products using the specified date. | Yes | - | | `$limit` | integer | The maximum number of products that could be returned | No | 1000 | | `$offset` | integer | Number of products to skip at the beginning of the list. | No | 0 | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | @@ -151,6 +153,7 @@ Returns products created before the specified date. | `$createdBefore` | | Filters the products using the specified date | Yes | - | | `$limit` | integer | The maximum number of products that could be returned | No | 1000 | | `$offset` | integer | Number of products to skip at the beginning of the list. | No | 0 | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | @@ -174,6 +177,7 @@ Returns products updated after the specified date. | $updatedAfter | DateTimeInterface | Filters the products using the specified date. The date provided will be included in the filter. | Yes | - | | $limit | integer | The maximum number of products that could be returned | No | 1000 | | $offset | integer | Number of products to skip at the beginning of the list. | No | 0 | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | @@ -197,6 +201,7 @@ Returns products updated before the specified date. | $updatedBefore | DateTimeInterface | Filters the products using the specified date. The date provided will be included in the filter. | No | - | | $limit | integer | The maximum number of products that could be returned | No | 1000 | | $offset | integer | Number of products to skip at the beginning of the list. | No | 0 | +| `$dateFormat` | string|null | Specify format of date to sent Seller Center | No | null | | `$debug` | bool | Whether it logs or not the request and response log | No | true | diff --git a/src/Service/BaseOrderManager.php b/src/Service/BaseOrderManager.php index d15abe5..886792d 100644 --- a/src/Service/BaseOrderManager.php +++ b/src/Service/BaseOrderManager.php @@ -30,6 +30,7 @@ class BaseOrderManager extends BaseManager public const DEFAULT_OFFSET = 0; public const DEFAULT_SORT_BY = 'created_at'; public const DEFAULT_SORT_DIRECTION = 'ASC'; + public const DEFAULT_DATE_FORMAT = 'Y-m-d\TH:i:s'; public function getOrder( int $orderId, @@ -193,16 +194,18 @@ public function getOrdersCreatedBetween( int $offset = self::DEFAULT_OFFSET, string $sortBy = self::DEFAULT_SORT_BY, string $sortDirection = self::DEFAULT_SORT_DIRECTION, + ?string $dateFormat = null, bool $debug = true ): array { + $dateFormat = $dateFormat ?? self::DEFAULT_DATE_FORMAT; $parameters = $this->makeParametersForGetOrdersAction(); $this->setListDimensions($parameters, $limit, $offset); $this->setSortParametersList($parameters, $sortBy, $sortDirection); $parameters->set([ - 'CreatedAfter' => $createdAfter->format('Y-m-d\TH:i:s'), - 'CreatedBefore' => $createdBefore->format('Y-m-d\TH:i:s'), + 'CreatedAfter' => $createdAfter->format($dateFormat), + 'CreatedBefore' => $createdBefore->format($dateFormat), ]); return $this->getOrders( @@ -221,16 +224,18 @@ public function getOrdersUpdatedBetween( int $offset = self::DEFAULT_OFFSET, string $sortBy = self::DEFAULT_SORT_BY, string $sortDirection = self::DEFAULT_SORT_DIRECTION, + ?string $dateFormat = null, bool $debug = true ): array { $parameters = $this->makeParametersForGetOrdersAction(); + $dateFormat = $dateFormat ?? self::DEFAULT_DATE_FORMAT; $this->setListDimensions($parameters, $limit, $offset); $this->setSortParametersList($parameters, $sortBy, $sortDirection); $parameters->set([ - 'UpdatedAfter' => $updatedAfter->format('Y-m-d\TH:i:s'), - 'UpdatedBefore' => $updatedBefore->format('Y-m-d\TH:i:s'), + 'UpdatedAfter' => $updatedAfter->format($dateFormat), + 'UpdatedBefore' => $updatedBefore->format($dateFormat), ]); return $this->getOrders( @@ -248,15 +253,17 @@ public function getOrdersCreatedAfter( int $offset = self::DEFAULT_OFFSET, string $sortBy = self::DEFAULT_SORT_BY, string $sortDirection = self::DEFAULT_SORT_DIRECTION, + ?string $dateFormat = null, bool $debug = true ): array { $parameters = $this->makeParametersForGetOrdersAction(); + $dateFormat = $dateFormat ?? self::DEFAULT_DATE_FORMAT; $this->setListDimensions($parameters, $limit, $offset); $this->setSortParametersList($parameters, $sortBy, $sortDirection); $parameters->set([ - 'CreatedAfter' => $createdAfter->format('Y-m-d\TH:i:s'), + 'CreatedAfter' => $createdAfter->format($dateFormat), ]); return $this->getOrders( @@ -274,15 +281,17 @@ public function getOrdersCreatedBefore( int $offset = self::DEFAULT_OFFSET, string $sortBy = self::DEFAULT_SORT_BY, string $sortDirection = self::DEFAULT_SORT_DIRECTION, + ?string $dateFormat = null, bool $debug = true ): array { $parameters = $this->makeParametersForGetOrdersAction(); + $dateFormat = $dateFormat ?? self::DEFAULT_DATE_FORMAT; $this->setListDimensions($parameters, $limit, $offset); $this->setSortParametersList($parameters, $sortBy, $sortDirection); $parameters->set([ - 'CreatedBefore' => $createdBefore->format('Y-m-d\TH:i:s'), + 'CreatedBefore' => $createdBefore->format($dateFormat), ]); return $this->getOrders( @@ -300,15 +309,17 @@ public function getOrdersUpdatedAfter( int $offset = self::DEFAULT_OFFSET, string $sortBy = self::DEFAULT_SORT_BY, string $sortDirection = self::DEFAULT_SORT_DIRECTION, + ?string $dateFormat = null, bool $debug = true ): array { $parameters = $this->makeParametersForGetOrdersAction(); + $dateFormat = $dateFormat ?? self::DEFAULT_DATE_FORMAT; $this->setListDimensions($parameters, $limit, $offset); $this->setSortParametersList($parameters, $sortBy, $sortDirection); $parameters->set([ - 'UpdatedAfter' => $updatedAfter->format('Y-m-d\TH:i:s'), + 'UpdatedAfter' => $updatedAfter->format($dateFormat), ]); return $this->getOrders( @@ -326,15 +337,17 @@ public function getOrdersUpdatedBefore( int $offset = self::DEFAULT_OFFSET, string $sortBy = self::DEFAULT_SORT_BY, string $sortDirection = self::DEFAULT_SORT_DIRECTION, + ?string $dateFormat = null, bool $debug = true ): array { $parameters = $this->makeParametersForGetOrdersAction(); + $dateFormat = $dateFormat ?? self::DEFAULT_DATE_FORMAT; $this->setListDimensions($parameters, $limit, $offset); $this->setSortParametersList($parameters, $sortBy, $sortDirection); $parameters->set([ - 'UpdatedBefore' => $updatedBefore->format('Y-m-d\TH:i:s'), + 'UpdatedBefore' => $updatedBefore->format($dateFormat), ]); return $this->getOrders( @@ -386,27 +399,29 @@ public function getOrdersFromParameters( int $offset = self::DEFAULT_OFFSET, string $sortBy = self::DEFAULT_SORT_BY, string $sortDirection = self::DEFAULT_SORT_DIRECTION, + ?string $dateFormat = null, bool $debug = true ): array { $parameters = $this->makeParametersForGetOrdersAction(); + $dateFormat = $dateFormat ?? self::DEFAULT_DATE_FORMAT; $this->setListDimensions($parameters, $limit, $offset); $this->setSortParametersList($parameters, $sortBy, $sortDirection); if (!empty($createdAfter)) { - $parameters->set(['CreatedAfter' => $createdAfter->format('Y-m-d\TH:i:s')]); + $parameters->set(['CreatedAfter' => $createdAfter->format($dateFormat)]); } if (!empty($createdBefore)) { - $parameters->set(['CreatedBefore' => $createdBefore->format('Y-m-d\TH:i:s')]); + $parameters->set(['CreatedBefore' => $createdBefore->format($dateFormat)]); } if (!empty($updatedAfter)) { - $parameters->set(['UpdatedAfter' => $updatedAfter->format('Y-m-d\TH:i:s')]); + $parameters->set(['UpdatedAfter' => $updatedAfter->format($dateFormat)]); } if (!empty($updatedBefore)) { - $parameters->set(['UpdatedBefore' => $updatedBefore->format('Y-m-d\TH:i:s')]); + $parameters->set(['UpdatedBefore' => $updatedBefore->format($dateFormat)]); } if (!empty($status) && in_array($status, OrderStatus::STATUS)) { diff --git a/src/Service/Contract/ProductManagerInterface.php b/src/Service/Contract/ProductManagerInterface.php index 946ad8e..4ac63ad 100644 --- a/src/Service/Contract/ProductManagerInterface.php +++ b/src/Service/Contract/ProductManagerInterface.php @@ -15,6 +15,7 @@ interface ProductManagerInterface public const DEFAULT_LIMIT = 1000; public const DEFAULT_OFFSET = 0; public const DEFAULT_FILTER = 'all'; + public const DEFAULT_DATE_FORMAT = DATE_ATOM; public function productUpdate(Products $products, bool $debug = true): FeedResponse; @@ -48,6 +49,7 @@ public function getProductsCreatedAfter( DateTimeInterface $createdAfter, int $limit = self::DEFAULT_LIMIT, int $offset = self::DEFAULT_OFFSET, + ?string $dateFormat = null, bool $debug = true ): array; @@ -58,6 +60,7 @@ public function getProductsCreatedBefore( DateTimeInterface $createdBefore, int $limit = self::DEFAULT_LIMIT, int $offset = self::DEFAULT_OFFSET, + ?string $dateFormat = null, bool $debug = true ): array; @@ -67,7 +70,8 @@ public function getProductsCreatedBefore( public function getProductsUpdatedAfter( DateTimeInterface $updatedAfter, int $limit = self::DEFAULT_LIMIT, - int $offset = self::DEFAULT_LIMIT, + int $offset = self::DEFAULT_OFFSET, + ?string $dateFormat = null, bool $debug = true ): array; @@ -78,6 +82,7 @@ public function getProductsUpdatedBefore( DateTimeInterface $updatedBefore, int $limit = self::DEFAULT_LIMIT, int $offset = self::DEFAULT_OFFSET, + ?string $dateFormat = null, bool $debug = true ): array; @@ -128,6 +133,7 @@ public function getProductsFromParameters( ?array $skuSellerList = null, ?DateTimeInterface $updateAfter = null, ?DateTimeInterface $updateBefore = null, + ?string $dateFormat = null, bool $debug = true ): array; diff --git a/src/Service/GlobalProductManager.php b/src/Service/GlobalProductManager.php index 3b7e360..38b9130 100644 --- a/src/Service/GlobalProductManager.php +++ b/src/Service/GlobalProductManager.php @@ -155,14 +155,16 @@ public function getProductsCreatedAfter( DateTimeInterface $createdAfter, int $limit = self::DEFAULT_LIMIT, int $offset = self::DEFAULT_OFFSET, + ?string $dateFormat = null, bool $debug = true ): array { $parameters = clone $this->parameters; + $dateFormat = $dateFormat ?? self::DEFAULT_DATE_FORMAT; $this->setListDimensions($parameters, $limit, $offset); $parameters->set( - ['CreatedAfter' => $createdAfter->format(DATE_ATOM)] + ['CreatedAfter' => $createdAfter->format($dateFormat)] ); return $this->getProducts($parameters, $debug); @@ -175,14 +177,16 @@ public function getProductsCreatedBefore( DateTimeInterface $createdBefore, int $limit = self::DEFAULT_LIMIT, int $offset = self::DEFAULT_OFFSET, + ?string $dateFormat = null, bool $debug = true ): array { $parameters = clone $this->parameters; + $dateFormat = $dateFormat ?? self::DEFAULT_DATE_FORMAT; $this->setListDimensions($parameters, $limit, $offset); $parameters->set( - ['CreatedBefore' => $createdBefore->format(DATE_ATOM)] + ['CreatedBefore' => $createdBefore->format($dateFormat)] ); return $this->getProducts($parameters, $debug); @@ -194,15 +198,17 @@ public function getProductsCreatedBefore( public function getProductsUpdatedAfter( DateTimeInterface $updatedAfter, int $limit = self::DEFAULT_LIMIT, - int $offset = self::DEFAULT_LIMIT, + int $offset = self::DEFAULT_OFFSET, + ?string $dateFormat = null, bool $debug = true ): array { $parameters = clone $this->parameters; + $dateFormat = $dateFormat ?? self::DEFAULT_DATE_FORMAT; $this->setListDimensions($parameters, $limit, $offset); $parameters->set( - ['UpdatedAfter' => $updatedAfter->format(DATE_ATOM)] + ['UpdatedAfter' => $updatedAfter->format($dateFormat)] ); return $this->getProducts($parameters, $debug); @@ -215,14 +221,16 @@ public function getProductsUpdatedBefore( DateTimeInterface $updatedBefore, int $limit = self::DEFAULT_LIMIT, int $offset = self::DEFAULT_OFFSET, + ?string $dateFormat = null, bool $debug = true ): array { $parameters = clone $this->parameters; + $dateFormat = $dateFormat ?? self::DEFAULT_DATE_FORMAT; $this->setListDimensions($parameters, $limit, $offset); $parameters->set( - ['UpdatedBefore' => $updatedBefore->format(DATE_ATOM)] + ['UpdatedBefore' => $updatedBefore->format($dateFormat)] ); return $this->getProducts($parameters, $debug); @@ -313,9 +321,11 @@ public function getProductsFromParameters( ?array $skuSellerList = null, ?DateTimeInterface $updateAfter = null, ?DateTimeInterface $updateBefore = null, + ?string $dateFormat = null, bool $debug = true ): array { $parameters = clone $this->parameters; + $dateFormat = $dateFormat ?? self::DEFAULT_DATE_FORMAT; $this->setListDimensions($parameters, $limit, $offset); @@ -331,11 +341,11 @@ public function getProductsFromParameters( ); if (!empty($createdAfter)) { - $parameters->set(['CreatedAfter' => $createdAfter->format(DATE_ATOM)]); + $parameters->set(['CreatedAfter' => $createdAfter->format($dateFormat)]); } if (!empty($createdBefore)) { - $parameters->set(['CreatedBefore' => $createdBefore->format(DATE_ATOM)]); + $parameters->set(['CreatedBefore' => $createdBefore->format($dateFormat)]); } if (!empty($skuSellerList)) { @@ -343,11 +353,11 @@ public function getProductsFromParameters( } if (!empty($updateAfter)) { - $parameters->set(['UpdateAfter' => $updateAfter->format(DATE_ATOM)]); + $parameters->set(['UpdateAfter' => $updateAfter->format($dateFormat)]); } if (!empty($updateBefore)) { - $parameters->set(['UpdateBefore' => $updateBefore->format(DATE_ATOM)]); + $parameters->set(['UpdateBefore' => $updateBefore->format($dateFormat)]); } return $this->getProducts($parameters, $debug); diff --git a/src/Service/ProductManager.php b/src/Service/ProductManager.php index 193be03..e78b7be 100644 --- a/src/Service/ProductManager.php +++ b/src/Service/ProductManager.php @@ -157,14 +157,16 @@ public function getProductsCreatedAfter( DateTimeInterface $createdAfter, int $limit = self::DEFAULT_LIMIT, int $offset = self::DEFAULT_OFFSET, + ?string $dateFormat = null, bool $debug = true ): array { $parameters = clone $this->parameters; + $dateFormat = $dateFormat ?? self::DEFAULT_DATE_FORMAT; $this->setListDimensions($parameters, $limit, $offset); $parameters->set( - ['CreatedAfter' => $createdAfter->format(DATE_ATOM)] + ['CreatedAfter' => $createdAfter->format($dateFormat)] ); return $this->getProducts( @@ -180,14 +182,16 @@ public function getProductsCreatedBefore( DateTimeInterface $createdBefore, int $limit = self::DEFAULT_LIMIT, int $offset = self::DEFAULT_OFFSET, + ?string $dateFormat = null, bool $debug = true ): array { $parameters = clone $this->parameters; + $dateFormat = $dateFormat ?? self::DEFAULT_DATE_FORMAT; $this->setListDimensions($parameters, $limit, $offset); $parameters->set( - ['CreatedBefore' => $createdBefore->format(DATE_ATOM)] + ['CreatedBefore' => $createdBefore->format($dateFormat)] ); return $this->getProducts( @@ -202,15 +206,17 @@ public function getProductsCreatedBefore( public function getProductsUpdatedAfter( DateTimeInterface $updatedAfter, int $limit = self::DEFAULT_LIMIT, - int $offset = self::DEFAULT_LIMIT, + int $offset = self::DEFAULT_OFFSET, + ?string $dateFormat = null, bool $debug = true ): array { $parameters = clone $this->parameters; + $dateFormat = $dateFormat ?? self::DEFAULT_DATE_FORMAT; $this->setListDimensions($parameters, $limit, $offset); $parameters->set( - ['UpdatedAfter' => $updatedAfter->format(DATE_ATOM)] + ['UpdatedAfter' => $updatedAfter->format($dateFormat)] ); return $this->getProducts( @@ -226,14 +232,16 @@ public function getProductsUpdatedBefore( DateTimeInterface $updatedBefore, int $limit = self::DEFAULT_LIMIT, int $offset = self::DEFAULT_OFFSET, + ?string $dateFormat = null, bool $debug = true ): array { $parameters = clone $this->parameters; + $dateFormat = $dateFormat ?? self::DEFAULT_DATE_FORMAT; $this->setListDimensions($parameters, $limit, $offset); $parameters->set( - ['UpdatedBefore' => $updatedBefore->format(DATE_ATOM)] + ['UpdatedBefore' => $updatedBefore->format($dateFormat)] ); return $this->getProducts( @@ -336,9 +344,11 @@ public function getProductsFromParameters( ?array $skuSellerList = null, ?DateTimeInterface $updateAfter = null, ?DateTimeInterface $updateBefore = null, + ?string $dateFormat = null, bool $debug = true ): array { $parameters = clone $this->parameters; + $dateFormat = $dateFormat ?? self::DEFAULT_DATE_FORMAT; $this->setListDimensions($parameters, $limit, $offset); @@ -354,11 +364,11 @@ public function getProductsFromParameters( ); if (!empty($createdAfter)) { - $parameters->set(['CreatedAfter' => $createdAfter->format(DATE_ATOM)]); + $parameters->set(['CreatedAfter' => $createdAfter->format($dateFormat)]); } if (!empty($createdBefore)) { - $parameters->set(['CreatedBefore' => $createdBefore->format(DATE_ATOM)]); + $parameters->set(['CreatedBefore' => $createdBefore->format($dateFormat)]); } if (!empty($skuSellerList)) { @@ -366,11 +376,11 @@ public function getProductsFromParameters( } if (!empty($updateAfter)) { - $parameters->set(['UpdateAfter' => $updateAfter->format(DATE_ATOM)]); + $parameters->set(['UpdateAfter' => $updateAfter->format($dateFormat)]); } if (!empty($updateBefore)) { - $parameters->set(['UpdateBefore' => $updateBefore->format(DATE_ATOM)]); + $parameters->set(['UpdateBefore' => $updateBefore->format($dateFormat)]); } return $this->getProducts( diff --git a/tests/Functional/BaseOrderManagerTest.php b/tests/Functional/BaseOrderManagerTest.php index 23fd227..0dfab58 100644 --- a/tests/Functional/BaseOrderManagerTest.php +++ b/tests/Functional/BaseOrderManagerTest.php @@ -97,7 +97,8 @@ public function testItReturnsACollectionOfOrdersCreatedBetweenADateTime( ?DateTimeImmutable $createdBefore, string $sortBy, string $sortDirection, - string $status + string $status, + ?string $dateFormat ): void { $sdkClient = $this->getSdkClient($this->getOrdersResponse()); @@ -107,7 +108,8 @@ public function testItReturnsACollectionOfOrdersCreatedBetweenADateTime( OrderManager::DEFAULT_LIMIT, OrderManager::DEFAULT_OFFSET, $sortBy, - $sortDirection + $sortDirection, + $dateFormat ); $this->assertIsArray($result); @@ -122,7 +124,8 @@ public function testItReturnsACollectionOfOrdersUpdatedBetweenADateTime( ?DateTimeImmutable $updatedBefore, string $sortBy, string $sortDirection, - string $status + string $status, + ?string $dateFormat ): void { $sdkClient = $this->getSdkClient($this->getOrdersResponse()); @@ -132,7 +135,8 @@ public function testItReturnsACollectionOfOrdersUpdatedBetweenADateTime( OrderManager::DEFAULT_LIMIT, OrderManager::DEFAULT_OFFSET, $sortBy, - $sortDirection + $sortDirection, + $dateFormat ); $this->assertIsArray($result); @@ -147,7 +151,8 @@ public function testItReturnsACollectionOfOrdersCreatedAfterADateTime( ?DateTimeImmutable $unused, string $sortBy, string $sortDirection, - string $status + string $status, + ?string $dateFormat ): void { $sdkClient = $this->getSdkClient($this->getOrdersResponse()); @@ -156,7 +161,8 @@ public function testItReturnsACollectionOfOrdersCreatedAfterADateTime( OrderManager::DEFAULT_LIMIT, OrderManager::DEFAULT_OFFSET, $sortBy, - $sortDirection + $sortDirection, + $dateFormat ); $this->assertIsArray($result); @@ -171,7 +177,8 @@ public function testItReturnsACollectionOfOrdersCreatedBeforeADateTime( ?DateTimeImmutable $unused, string $sortBy, string $sortDirection, - string $status + string $status, + ?string $dateFormat ): void { $sdkClient = $this->getSdkClient($this->getOrdersResponse()); @@ -180,7 +187,8 @@ public function testItReturnsACollectionOfOrdersCreatedBeforeADateTime( OrderManager::DEFAULT_LIMIT, OrderManager::DEFAULT_OFFSET, $sortBy, - $sortDirection + $sortDirection, + $dateFormat ); $this->assertIsArray($result); @@ -195,7 +203,8 @@ public function testItReturnsACollectionOfOrdersUpdatedAfterADateTime( ?DateTimeImmutable $unused, string $sortBy, string $sortDirection, - string $status + string $status, + ?string $dateFormat ): void { $sdkClient = $this->getSdkClient($this->getOrdersResponse()); @@ -204,7 +213,8 @@ public function testItReturnsACollectionOfOrdersUpdatedAfterADateTime( OrderManager::DEFAULT_LIMIT, OrderManager::DEFAULT_OFFSET, $sortBy, - $sortDirection + $sortDirection, + $dateFormat ); $this->assertIsArray($result); @@ -219,7 +229,8 @@ public function testItReturnsACollectionOfOrdersUpdatedBeforeADateTime( ?DateTimeImmutable $unused, string $sortBy, string $sortDirection, - string $status + string $status, + ?string $dateFormat ): void { $sdkClient = $this->getSdkClient($this->getOrdersResponse()); @@ -228,7 +239,8 @@ public function testItReturnsACollectionOfOrdersUpdatedBeforeADateTime( OrderManager::DEFAULT_LIMIT, OrderManager::DEFAULT_OFFSET, $sortBy, - $sortDirection + $sortDirection, + $dateFormat ); $this->assertIsArray($result); @@ -243,7 +255,8 @@ public function testItReturnsACollectionOfOrdersWithStatus( ?DateTimeImmutable $unused2, string $sortBy, string $sortDirection, - string $status + string $status, + ?string $dateFormat ): void { $sdkClient = $this->getSdkClient($this->getOrdersResponse()); @@ -498,6 +511,7 @@ public function testItLogsDependingOnDebugParamWhenGetOrdersCreatedBetweenSucces $offset, $sortBy, $sortDirection, + null, $debug ); } @@ -535,6 +549,7 @@ public function testItLogsDependingOnDebugParamWhenGetOrdersUpdatedBetweenSucces $offset, $sortBy, $sortDirection, + null, $debug ); } @@ -570,6 +585,7 @@ public function testItLogsDependingOnDebugParamWhenGetOrdersCreatedBeforeSuccess $offset, $sortBy, $sortDirection, + null, $debug ); } @@ -605,6 +621,7 @@ public function testItLogsDependingOnDebugParamWhenGetOrdersUpdatedBeforeSuccess $offset, $sortBy, $sortDirection, + null, $debug ); } @@ -640,6 +657,7 @@ public function testItLogsDependingOnDebugParamWhenGetOrdersCreatedAfterSuccessR $offset, $sortBy, $sortDirection, + null, $debug ); } @@ -675,6 +693,7 @@ public function testItLogsDependingOnDebugParamWhenGetOrdersUpdatedAfterSuccessR $offset, $sortBy, $sortDirection, + null, $debug ); } @@ -713,6 +732,7 @@ public function testItLogsDependingOnDebugParamWhenGetOrdersFromParametersSucces $offset, $sortBy, $sortDirection, + null, $debug ); } @@ -784,13 +804,14 @@ public function dateTimesAndFilters(): array $date = DateTimeImmutable::createFromFormat('Y-m-d H:i:s', '2018-09-01 00:00:00'); return [ - [$date, $date, 'created_at', 'ASC', 'pending'], - [$date, $date, 'updated_at', 'ASC', 'canceled'], - [$date, $date, 'created_at', 'DESC', 'ready_to_ship'], - [$date, $date, 'updated_at', 'DESC', 'delivered'], - [$date, $date, 'created_at', 'ASC', 'returned'], - [$date, $date, 'updated_at', 'DESC', 'shipped'], - [$date, $date, 'created_at', 'ASC', 'failed'], + [$date, $date, 'created_at', 'ASC', 'pending', null], + [$date, $date, 'updated_at', 'ASC', 'canceled', null], + [$date, $date, 'created_at', 'DESC', 'ready_to_ship', null], + [$date, $date, 'updated_at', 'DESC', 'delivered', null], + [$date, $date, 'created_at', 'ASC', 'returned', null], + [$date, $date, 'updated_at', 'DESC', 'shipped', null], + [$date, $date, 'created_at', 'ASC', 'failed', null], + [$date, $date, 'created_at', 'ASC', 'pending', 'Y-m-d\TH:i:s\Z'], ]; } diff --git a/tests/Functional/GlobalProductManagerTest.php b/tests/Functional/GlobalProductManagerTest.php index 3b5105c..52cb08e 100644 --- a/tests/Functional/GlobalProductManagerTest.php +++ b/tests/Functional/GlobalProductManagerTest.php @@ -18,6 +18,7 @@ use Linio\SellerCenter\Model\Product\ProductData; use Linio\SellerCenter\Model\Product\Products; use Linio\SellerCenter\Response\FeedResponse; +use Linio\SellerCenter\Service\Contract\ProductManagerInterface; use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; use Psr\Log\LoggerInterface; @@ -80,49 +81,81 @@ public function testItReturnsACollectionOfProducts(): void $this->assertContainsOnlyInstancesOf(GlobalProduct::class, $result); } - public function testItReturnsACollectionOfProductsCreatedAfterADateTime(): void + /** + * @dataProvider dateTimeProvider + */ + public function testItReturnsACollectionOfProductsCreatedAfterADateTime(?string $dateFormat): void { $sdkClient = $this->getSdkClient($this->getSchema('Product/GlobalProductsResponse.xml')); $createdAfter = DateTimeImmutable::createFromFormat('Y-m-d H:i:s', '2018-09-01 00:00:00'); - $result = $sdkClient->globalProducts()->getProductsCreatedAfter($createdAfter); + $result = $sdkClient->globalProducts()->getProductsCreatedAfter( + $createdAfter, + ProductManagerInterface::DEFAULT_LIMIT, + ProductManagerInterface::DEFAULT_OFFSET, + $dateFormat + ); $this->assertIsArray($result); $this->assertContainsOnlyInstancesOf(GlobalProduct::class, $result); } - public function testItReturnsACollectionOfProductsCreatedBeforeADateTime(): void + /** + * @dataProvider dateTimeProvider + */ + public function testItReturnsACollectionOfProductsCreatedBeforeADateTime(?string $dateFormat): void { $sdkClient = $this->getSdkClient($this->getSchema('Product/GlobalProductsResponse.xml')); $createdBefore = DateTimeImmutable::createFromFormat('Y-m-d H:i:s', '2019-01-23 00:00:00'); - $result = $sdkClient->globalProducts()->getProductsCreatedBefore($createdBefore); + $result = $sdkClient->globalProducts()->getProductsCreatedBefore( + $createdBefore, + ProductManagerInterface::DEFAULT_LIMIT, + ProductManagerInterface::DEFAULT_OFFSET, + $dateFormat + ); $this->assertIsArray($result); $this->assertContainsOnlyInstancesOf(GlobalProduct::class, $result); } - public function testItReturnsACollectionOfProductsUpdatedAfterADateTime(): void + /** + * @dataProvider dateTimeProvider + */ + public function testItReturnsACollectionOfProductsUpdatedAfterADateTime(?string $dateFormat): void { $sdkClient = $this->getSdkClient($this->getSchema('Product/GlobalProductsResponse.xml')); $updatedAfter = DateTimeImmutable::createFromFormat('Y-m-d H:i:s', '2019-01-23 00:00:00'); - $result = $sdkClient->globalProducts()->getProductsUpdatedAfter($updatedAfter); + $result = $sdkClient->globalProducts()->getProductsUpdatedAfter( + $updatedAfter, + ProductManagerInterface::DEFAULT_LIMIT, + ProductManagerInterface::DEFAULT_OFFSET, + $dateFormat + ); $this->assertIsArray($result); $this->assertContainsOnlyInstancesOf(GlobalProduct::class, $result); } - public function testItReturnsACollectionOfProductsUpdatedBeforeADateTime(): void + /** + * @dataProvider dateTimeProvider + */ + public function testItReturnsACollectionOfProductsUpdatedBeforeADateTime(?string $dateFormat): void { $sdkClient = $this->getSdkClient($this->getSchema('Product/GlobalProductsResponse.xml')); $updatedBefore = DateTimeImmutable::createFromFormat('Y-m-d H:i:s', '2019-01-23 00:00:00'); - $result = $sdkClient->globalProducts()->getProductsUpdatedBefore($updatedBefore); + $result = $sdkClient->globalProducts()->getProductsUpdatedBefore( + $updatedBefore, + ProductManagerInterface::DEFAULT_LIMIT, + ProductManagerInterface::DEFAULT_OFFSET, + $dateFormat + ); $this->assertIsArray($result); $this->assertContainsOnlyInstancesOf(GlobalProduct::class, $result); @@ -174,7 +207,10 @@ public function testItThrowsExceptionWithANullSkuSellerList(): void $sdkClient->globalProducts()->getProductsBySellerSku([]); } - public function testItReturnsACollectionOfProductsFromParameters(): void + /** + * @dataProvider dateTimeProvider + */ + public function testItReturnsACollectionOfProductsFromParameters(?string $dateFormat): void { $sdkClient = $this->getSdkClient($this->getSchema('Product/GlobalProductsResponse.xml')); @@ -195,7 +231,8 @@ public function testItReturnsACollectionOfProductsFromParameters(): void 0, $skuSellerList, $updatedAfter, - $updatedBefore + $updatedBefore, + $dateFormat ); $this->assertIsArray($result); @@ -386,6 +423,7 @@ public function testItLogsDependingOnDebugParamWhenGetProductsCreatedAfterGlobal DateTimeImmutable::createFromFormat('Y-m-d H:i:s', '2018-09-01 00:00:00'), 100, 100, + ProductManagerInterface::DEFAULT_DATE_FORMAT, $debug ); } @@ -405,6 +443,7 @@ public function testItLogsDependingOnDebugParamWhenGetProductsCreatedBeforeGloba DateTimeImmutable::createFromFormat('Y-m-d H:i:s', '2018-09-01 00:00:00'), 100, 100, + ProductManagerInterface::DEFAULT_DATE_FORMAT, $debug ); } @@ -424,6 +463,7 @@ public function testItLogsDependingOnDebugParamWhenGetProductsUpdatedAfterGlobal DateTimeImmutable::createFromFormat('Y-m-d H:i:s', '2018-09-01 00:00:00'), 100, 100, + ProductManagerInterface::DEFAULT_DATE_FORMAT, $debug ); } @@ -443,6 +483,7 @@ public function testItLogsDependingOnDebugParamWhenGetProductsUpdatedBeforeGloba DateTimeImmutable::createFromFormat('Y-m-d H:i:s', '2018-09-01 00:00:00'), 100, 100, + ProductManagerInterface::DEFAULT_DATE_FORMAT, $debug ); } @@ -525,6 +566,7 @@ public function testItLogsDependingOnDebugParamWhenGetProductsFromParametersGlob ['test-sku'], null, null, + ProductManagerInterface::DEFAULT_DATE_FORMAT, $debug ); } @@ -679,4 +721,12 @@ public function debugParameter() [true], ]; } + + public function dateTimeProvider(): array + { + return [ + 'defaultFormat' => [null], + 'anotherFormat' => ['Y-m-d H:i:s'], + ]; + } } diff --git a/tests/Functional/ProductManagerTest.php b/tests/Functional/ProductManagerTest.php index 1988650..7278dae 100644 --- a/tests/Functional/ProductManagerTest.php +++ b/tests/Functional/ProductManagerTest.php @@ -16,6 +16,7 @@ use Linio\SellerCenter\Model\Product\ProductData; use Linio\SellerCenter\Model\Product\Products; use Linio\SellerCenter\Response\FeedResponse; +use Linio\SellerCenter\Service\Contract\ProductManagerInterface; use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; use Psr\Log\LoggerInterface; @@ -77,49 +78,81 @@ public function testItReturnsACollectionOfProducts(): void $this->assertContainsOnlyInstancesOf(Product::class, $result); } - public function testItReturnsACollectionOfProductsCreatedAfterADateTime(): void + /** + * @dataProvider dateTimeProvider + */ + public function testItReturnsACollectionOfProductsCreatedAfterADateTime(?string $dateFormat): void { $sdkClient = $this->getSdkClient($this->getSchema('Product/ProductsResponse.xml')); $createdAfter = DateTimeImmutable::createFromFormat('Y-m-d H:i:s', '2018-09-01 00:00:00'); - $result = $sdkClient->products()->getProductsCreatedAfter($createdAfter); + $result = $sdkClient->products()->getProductsCreatedAfter( + $createdAfter, + ProductManagerInterface::DEFAULT_LIMIT, + ProductManagerInterface::DEFAULT_OFFSET, + $dateFormat + ); $this->assertIsArray($result); $this->assertContainsOnlyInstancesOf(Product::class, $result); } - public function testItReturnsACollectionOfProductsCreatedBeforeADateTime(): void + /** + * @dataProvider dateTimeProvider + */ + public function testItReturnsACollectionOfProductsCreatedBeforeADateTime(?string $dateFormat): void { $sdkClient = $this->getSdkClient($this->getSchema('Product/ProductsResponse.xml')); $createdBefore = DateTimeImmutable::createFromFormat('Y-m-d H:i:s', '2019-01-23 00:00:00'); - $result = $sdkClient->products()->getProductsCreatedBefore($createdBefore); + $result = $sdkClient->products()->getProductsCreatedBefore( + $createdBefore, + ProductManagerInterface::DEFAULT_LIMIT, + ProductManagerInterface::DEFAULT_OFFSET, + $dateFormat + ); $this->assertIsArray($result); $this->assertContainsOnlyInstancesOf(Product::class, $result); } - public function testItReturnsACollectionOfProductsUpdatedAfterADateTime(): void + /** + * @dataProvider dateTimeProvider + */ + public function testItReturnsACollectionOfProductsUpdatedAfterADateTime(?string $dateFormat): void { $sdkClient = $this->getSdkClient($this->getSchema('Product/ProductsResponse.xml')); $updatedAfter = DateTimeImmutable::createFromFormat('Y-m-d H:i:s', '2019-01-23 00:00:00'); - $result = $sdkClient->products()->getProductsUpdatedAfter($updatedAfter); + $result = $sdkClient->products()->getProductsUpdatedAfter( + $updatedAfter, + ProductManagerInterface::DEFAULT_LIMIT, + ProductManagerInterface::DEFAULT_OFFSET, + $dateFormat + ); $this->assertIsArray($result); $this->assertContainsOnlyInstancesOf(Product::class, $result); } - public function testItReturnsACollectionOfProductsUpdatedBeforeADateTime(): void + /** + * @dataProvider dateTimeProvider + */ + public function testItReturnsACollectionOfProductsUpdatedBeforeADateTime(?string $dateFormat): void { $sdkClient = $this->getSdkClient($this->getSchema('Product/ProductsResponse.xml')); $updatedBefore = DateTimeImmutable::createFromFormat('Y-m-d H:i:s', '2019-01-23 00:00:00'); - $result = $sdkClient->products()->getProductsUpdatedBefore($updatedBefore); + $result = $sdkClient->products()->getProductsUpdatedBefore( + $updatedBefore, + ProductManagerInterface::DEFAULT_LIMIT, + ProductManagerInterface::DEFAULT_OFFSET, + $dateFormat + ); $this->assertIsArray($result); $this->assertContainsOnlyInstancesOf(Product::class, $result); @@ -171,7 +204,10 @@ public function testItThrowsExceptionWithANullSkuSellerList(): void $sdkClient->products()->getProductsBySellerSku([]); } - public function testItReturnsACollectionOfProductsFromParameters(): void + /** + * @dataProvider dateTimeProvider + */ + public function testItReturnsACollectionOfProductsFromParameters(?string $dateFormat): void { $sdkClient = $this->getSdkClient($this->getSchema('Product/ProductsResponse.xml')); @@ -192,7 +228,8 @@ public function testItReturnsACollectionOfProductsFromParameters(): void 0, $skuSellerList, $updatedAfter, - $updatedBefore + $updatedBefore, + $dateFormat ); $this->assertIsArray($result); @@ -383,6 +420,7 @@ public function testItLogsDependingOnDebugParamWhenGetProductsCreatedAfterSucces DateTimeImmutable::createFromFormat('Y-m-d H:i:s', '2018-09-01 00:00:00'), 100, 100, + null, $debug ); } @@ -402,6 +440,7 @@ public function testItLogsDependingOnDebugParamWhenGetProductsCreatedBeforeSucce DateTimeImmutable::createFromFormat('Y-m-d H:i:s', '2018-09-01 00:00:00'), 100, 100, + null, $debug ); } @@ -421,6 +460,7 @@ public function testItLogsDependingOnDebugParamWhenGetProductsUpdatedAfterSucces DateTimeImmutable::createFromFormat('Y-m-d H:i:s', '2018-09-01 00:00:00'), 100, 100, + null, $debug ); } @@ -440,6 +480,7 @@ public function testItLogsDependingOnDebugParamWhenGetProductsUpdatedBeforeSucce DateTimeImmutable::createFromFormat('Y-m-d H:i:s', '2018-09-01 00:00:00'), 100, 100, + null, $debug ); } @@ -522,6 +563,7 @@ public function testItLogsDependingOnDebugParamWhenGetProductsFromParametersSucc ['test-sku'], null, null, + null, $debug ); } @@ -658,4 +700,12 @@ public function debugParameter() [true], ]; } + + public function dateTimeProvider(): array + { + return [ + 'defaultFormat' => [null], + 'anotherFormat' => ['Y-m-d H:i:s'], + ]; + } }