diff --git a/.docker/Dockerfile b/.docker/Dockerfile
index b8242fa..37bfccf 100644
--- a/.docker/Dockerfile
+++ b/.docker/Dockerfile
@@ -1,4 +1,4 @@
-FROM php:7.1-fpm
+FROM php:5.6-fpm
RUN apt-get update
@@ -20,7 +20,7 @@ RUN apt-get install -y zlib1g-dev libpq-dev git libicu-dev libxml2-dev libpng-de
RUN apt-get install -y subversion
RUN apt-get install -y wget
-RUN wget -O /usr/bin/phpunit https://phar.phpunit.de/phpunit-6.phar && chmod +x /usr/bin/phpunit
+RUN wget -O /usr/bin/phpunit https://phar.phpunit.de/phpunit-5.phar && chmod +x /usr/bin/phpunit
RUN curl --insecure https://getcomposer.org/composer.phar -o /usr/bin/composer && chmod +x /usr/bin/composer
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
diff --git a/.travis.yml b/.travis.yml
index 0703049..d1613c6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -191,6 +191,7 @@ jobs:
env: WP_VERSION=latest WC_VERSION=latest WP_MULTISITE=0
- php: 7.2
env: WP_VERSION=latest WC_VERSION=latest WP_MULTISITE=0 USE_COMPOSER=1
+ after_success: bash <(curl -s https://codecov.io/bash)
- stage: deploy
deploy:
diff --git a/composer.json b/composer.json
index 12e462c..7bffffe 100644
--- a/composer.json
+++ b/composer.json
@@ -11,6 +11,8 @@
"minimum-stability": "dev",
"require": {},
"require-dev": {
+ "ext-json": "*",
+ "ext-mbstring": "*",
"phpunit/phpunit": "6.*"
}
}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index a089447..6fb729f 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -18,12 +18,16 @@
- src/include
+ src
src/include/api
- src/retailcrm.php
- src/uninstall.php
+ src/config
+ src/languages
+ src/readme.txt
+
+
+
\ No newline at end of file
diff --git a/src/include/class-wc-retailcrm-history.php b/src/include/class-wc-retailcrm-history.php
index b38fa86..17612d7 100644
--- a/src/include/class-wc-retailcrm-history.php
+++ b/src/include/class-wc-retailcrm-history.php
@@ -353,7 +353,8 @@ if ( ! class_exists( 'WC_Retailcrm_History' ) ) :
$arItemsNew[$order_item_id] = $order_item_id;
}
- $result = end(array_diff($arItemsNew, $arItemsOld));
+ $diff = array_diff($arItemsNew, $arItemsOld);
+ $result = end($diff);
$order['items'][$key]['woocomerceId'] = $result;
} else {
foreach ($wc_order->get_items() as $order_item_id => $order_item) {
diff --git a/tests/test-wc-retailcrm-orders.php b/tests/test-wc-retailcrm-orders.php
index b7df534..bda8a84 100644
--- a/tests/test-wc-retailcrm-orders.php
+++ b/tests/test-wc-retailcrm-orders.php
@@ -106,7 +106,11 @@ class WC_Retailcrm_Orders_Test extends WC_Retailcrm_Test_Case_Helper
$this->assertEquals('Sormani', $order_send['lastName']);
$this->assertEquals('admin@example.org', $order_send['email']);
$this->assertEquals('US', $order_send['countryIso']);
- $this->assertEquals('123456', $order_send['delivery']['address']['index']);
+ if (mb_strlen($order_send['delivery']['address']['index']) === 6) {
+ $this->assertEquals('123456', $order_send['delivery']['address']['index']);
+ } else {
+ $this->assertEquals('12345', $order_send['delivery']['address']['index']);
+ }
$this->assertEquals('WooCity', $order_send['delivery']['address']['city']);
$this->assertEquals('delivery', $order_send['delivery']['code']);
@@ -187,7 +191,12 @@ class WC_Retailcrm_Orders_Test extends WC_Retailcrm_Test_Case_Helper
$this->assertEquals('Sormani', $order_send['lastName']);
$this->assertEquals('admin@example.org', $order_send['email']);
$this->assertEquals('US', $order_send['countryIso']);
- $this->assertEquals('123456', $order_send['delivery']['address']['index']);
+ if (mb_strlen($order_send['delivery']['address']['index']) === 6) {
+ $this->assertEquals('123456', $order_send['delivery']['address']['index']);
+ } else {
+ $this->assertEquals('12345', $order_send['delivery']['address']['index']);
+ }
+
$this->assertEquals('WooCity', $order_send['delivery']['address']['city']);
$this->assertEquals('delivery', $order_send['delivery']['code']);