commit
0212ddf823
34
.docker/Dockerfile
Normal file
34
.docker/Dockerfile
Normal file
@ -0,0 +1,34 @@
|
||||
FROM php:7.1-fpm
|
||||
|
||||
RUN apt-get update
|
||||
|
||||
RUN apt-get install -y zlib1g-dev libpq-dev git libicu-dev libxml2-dev libpng-dev libjpeg-dev libmcrypt-dev libxslt-dev libfreetype6-dev \
|
||||
&& docker-php-ext-configure intl \
|
||||
&& docker-php-ext-install intl \
|
||||
&& docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
|
||||
&& docker-php-ext-install mysqli pdo pdo_mysql \
|
||||
&& docker-php-ext-install zip \
|
||||
&& docker-php-ext-install xml \
|
||||
&& docker-php-ext-configure gd --with-png-dir=/usr/local/ --with-jpeg-dir=/usr/local/ --with-freetype-dir=/usr/local/ \
|
||||
&& docker-php-ext-install gd \
|
||||
&& docker-php-ext-install mcrypt \
|
||||
&& docker-php-ext-install bcmath \
|
||||
&& docker-php-ext-install soap \
|
||||
&& docker-php-ext-install xsl \
|
||||
&& docker-php-ext-install mbstring
|
||||
|
||||
RUN apt-get install -y subversion
|
||||
RUN apt-get install -y wget
|
||||
|
||||
RUN wget -O /usr/bin/phpunit https://phar.phpunit.de/phpunit-7.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 -
|
||||
RUN apt-get install -y nodejs
|
||||
|
||||
# Set timezone
|
||||
RUN rm /etc/localtime
|
||||
RUN ln -s /usr/share/zoneinfo/Europe/Moscow /etc/localtime
|
||||
RUN "date"
|
||||
|
||||
WORKDIR /code
|
6
.env-dist
Normal file
6
.env-dist
Normal file
@ -0,0 +1,6 @@
|
||||
DB_NAME=wc_retailcrm_test
|
||||
DB_USER=wc_retailcrm
|
||||
DB_PASS=wc_retailcrm
|
||||
DB_HOST=mysql
|
||||
WP_VERSION=4.4
|
||||
WC_VERSION=3.0.0
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
/nbproject/
|
||||
/vendor/
|
||||
.idea/
|
||||
.env
|
||||
|
282
.travis.yml
282
.travis.yml
@ -1,34 +1,264 @@
|
||||
language: php
|
||||
|
||||
os: linux
|
||||
dist: trusty
|
||||
|
||||
sudo: false
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.6
|
||||
- 7.0
|
||||
- 7.1
|
||||
if: tag IS blank
|
||||
|
||||
env:
|
||||
- WP_VERSION=latest WP_MULTISITE=0
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- php: 7.2
|
||||
env: WP_VERSION=latest WP_MULTISITE=0 RUN_PHPCS=1
|
||||
stages:
|
||||
- test
|
||||
- github releases
|
||||
- deploy
|
||||
|
||||
before_script:
|
||||
- bash tests/bin/install.sh wc_retailcrm_test root '' localhost $WP_VERSION
|
||||
- nvm install 10
|
||||
- make install
|
||||
|
||||
script:
|
||||
- bash tests/bin/script.sh
|
||||
env:
|
||||
global:
|
||||
- DB_NAME=wc_retailcrm_test
|
||||
- DB_USER=root
|
||||
- DB_PASS=''
|
||||
- DB_HOST=localhost
|
||||
|
||||
deploy:
|
||||
skip_cleanup: true
|
||||
provider: script
|
||||
script: make
|
||||
on:
|
||||
php: 7.2
|
||||
branch: master
|
||||
condition: "$DEPLOY = true"
|
||||
script: make test
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.4 WC_VERSION=3.0.0 WP_MULTISITE=0
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.4 WC_VERSION=3.0.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.4 WC_VERSION=3.0.0 WP_MULTISITE=0
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.4 WC_VERSION=3.1.0 WP_MULTISITE=0
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.4 WC_VERSION=3.1.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.4 WC_VERSION=3.1.0 WP_MULTISITE=0
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.4 WC_VERSION=3.2.0 WP_MULTISITE=0
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.4 WC_VERSION=3.2.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.4 WC_VERSION=3.2.0 WP_MULTISITE=0
|
||||
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.5 WC_VERSION=3.0.0 WP_MULTISITE=0
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.5 WC_VERSION=3.0.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.5 WC_VERSION=3.0.0 WP_MULTISITE=0
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.5 WC_VERSION=3.1.0 WP_MULTISITE=0
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.5 WC_VERSION=3.1.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.5 WC_VERSION=3.1.0 WP_MULTISITE=0
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.5 WC_VERSION=3.2.0 WP_MULTISITE=0
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.5 WC_VERSION=3.2.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.5 WC_VERSION=3.2.0 WP_MULTISITE=0
|
||||
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.6 WC_VERSION=3.0.0 WP_MULTISITE=0
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.6 WC_VERSION=3.0.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.6 WC_VERSION=3.0.0 WP_MULTISITE=0
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.6 WC_VERSION=3.1.0 WP_MULTISITE=0
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.6 WC_VERSION=3.1.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.6 WC_VERSION=3.1.0 WP_MULTISITE=0
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.6 WC_VERSION=3.2.0 WP_MULTISITE=0
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.6 WC_VERSION=3.2.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.6 WC_VERSION=3.2.0 WP_MULTISITE=0
|
||||
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.7 WC_VERSION=3.0.0 WP_MULTISITE=0
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.7 WC_VERSION=3.0.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.7 WC_VERSION=3.0.0 WP_MULTISITE=0
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.7 WC_VERSION=3.1.0 WP_MULTISITE=0
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.7 WC_VERSION=3.1.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.7 WC_VERSION=3.1.0 WP_MULTISITE=0
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.7 WC_VERSION=3.2.0 WP_MULTISITE=0
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.7 WC_VERSION=3.2.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.7 WC_VERSION=3.2.0 WP_MULTISITE=0
|
||||
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.3.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.3.0 WP_MULTISITE=0
|
||||
- php: 7.0
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.3.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.3.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.3.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.4.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.4.0 WP_MULTISITE=0
|
||||
- php: 7.0
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.4.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.4.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.4.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.5.0 WP_MULTISITE=0
|
||||
- php: 7.0
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.5.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.5.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.5.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.3.0 WP_MULTISITE=0
|
||||
- php: 7.0
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.3.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.3.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.3.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.4.0 WP_MULTISITE=0
|
||||
- php: 7.0
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.4.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.4.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.4.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.5.0 WP_MULTISITE=0
|
||||
- php: 7.0
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.5.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.5.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.5.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 5.6
|
||||
env: WP_VERSION=5.0 WC_VERSION=3.6.0 WP_MULTISITE=0
|
||||
- php: 7.0
|
||||
env: WP_VERSION=5.0 WC_VERSION=3.6.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=5.0 WC_VERSION=3.6.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=5.0 WC_VERSION=3.6.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 5.6
|
||||
env: WP_VERSION=5.1 WC_VERSION=3.6.0 WP_MULTISITE=0
|
||||
- php: 7.0
|
||||
env: WP_VERSION=5.1 WC_VERSION=3.6.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=5.1 WC_VERSION=3.6.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=5.1 WC_VERSION=3.6.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 5.6
|
||||
env: WP_VERSION=5.2 WC_VERSION=3.6.0 WP_MULTISITE=0
|
||||
- php: 7.0
|
||||
env: WP_VERSION=5.2 WC_VERSION=3.6.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=5.2 WC_VERSION=3.6.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=5.2 WC_VERSION=3.6.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 7.0
|
||||
env: WP_VERSION=5.1 WC_VERSION=3.7.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=5.1 WC_VERSION=3.7.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=5.1 WC_VERSION=3.7.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 7.0
|
||||
env: WP_VERSION=5.2 WC_VERSION=3.7.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=5.2 WC_VERSION=3.7.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=5.2 WC_VERSION=3.7.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 7.0
|
||||
env: WP_VERSION=5.3 WC_VERSION=3.8.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=5.3 WC_VERSION=3.8.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=5.3 WC_VERSION=3.8.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 7.0
|
||||
env: WP_VERSION=latest WC_VERSION=3.9.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=latest WC_VERSION=3.9.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=latest WC_VERSION=3.9.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
- php: 7.3
|
||||
env: WP_VERSION=latest WC_VERSION=latest WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 7.0
|
||||
env: WP_VERSION=latest WC_VERSION=latest WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
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
|
||||
- php: 7.3
|
||||
env: WP_VERSION=latest WC_VERSION=latest WP_MULTISITE=0 USE_COMPOSER=1
|
||||
after_success: bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
- stage: github releases
|
||||
before_script: skip
|
||||
script: skip
|
||||
before_deploy:
|
||||
- export VERSION=`cat VERSION`
|
||||
- git config --local user.name "retailCRM"
|
||||
- git config --local user.email "support@retailcrm.ru"
|
||||
- export TRAVIS_TAG=v$VERSION
|
||||
- git tag $TRAVIS_TAG
|
||||
deploy:
|
||||
provider: releases
|
||||
token: $GITHUB_OAUTH_TOKEN
|
||||
cleanup: false
|
||||
on:
|
||||
condition: "$LAST_TAG != $CURRENT_VERSION"
|
||||
if: branch = master AND type = push AND fork = false
|
||||
- stage: deploy
|
||||
deploy:
|
||||
cleanup: false
|
||||
provider: script
|
||||
script: make
|
||||
if: branch = master AND type = push AND fork = false
|
22
Makefile
22
Makefile
@ -1,6 +1,8 @@
|
||||
FILE = $(TRAVIS_BUILD_DIR)/VERSION
|
||||
VERSION = `cat $(FILE)`
|
||||
|
||||
.PHONY: test
|
||||
|
||||
all: svn_clone svn_push remove_dir
|
||||
|
||||
svn_clone:
|
||||
@ -20,3 +22,23 @@ svn_push: /tmp/svn_plugin_dir
|
||||
|
||||
remove_dir:
|
||||
rm -rf /tmp/svn_plugin_dir
|
||||
|
||||
compile_pot:
|
||||
msgfmt resources/pot/retailcrm-ru_RU.pot -o src/languages/retailcrm-ru_RU.mo
|
||||
msgfmt resources/pot/retailcrm-es_ES.pot -o src/languages/retailcrm-es_ES.mo
|
||||
|
||||
install:
|
||||
bash tests/bin/install.sh $(DB_NAME) $(DB_USER) $(DB_HOST) $(WP_VERSION) $(WC_VERSION) $(DB_PASS) $(SKIP_DB_CREATE)
|
||||
ifeq ($(USE_COMPOSER),1)
|
||||
composer install
|
||||
endif
|
||||
|
||||
test:
|
||||
ifeq ($(USE_COMPOSER),1)
|
||||
vendor/phpunit/phpunit/phpunit -c phpunit.xml.dist
|
||||
else
|
||||
phpunit -c phpunit.xml.dist
|
||||
endif
|
||||
|
||||
local_test: install
|
||||
phpunit -c phpunit.xml.dist
|
||||
|
@ -5,6 +5,10 @@
|
||||
Woocommerce-module
|
||||
==================
|
||||
|
||||
Модуль интеграции с [retailCRM](http://retailcrm.ru)
|
||||
Integration plugin for WooCommerce and [retailCRM](http://retailcrm.ru)
|
||||
|
||||
Информация о [кастомизации](https://github.com/retailcrm/woocommerce-module/wiki/%D0%9A%D0%B0%D1%81%D1%82%D0%BE%D0%BC%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D1%8F-%D0%B8%D0%BD%D1%82%D0%B5%D0%B3%D1%80%D0%B0%D1%86%D0%B8%D0%BE%D0%BD%D0%BD%D0%BE%D0%B3%D0%BE-%D0%BF%D0%BB%D0%B0%D0%B3%D0%B8%D0%BD%D0%B0)
|
||||
[Customization](https://github.com/retailcrm/woocommerce-module/wiki/%D0%9A%D0%B0%D1%81%D1%82%D0%BE%D0%BC%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D1%8F-%D0%B8%D0%BD%D1%82%D0%B5%D0%B3%D1%80%D0%B0%D1%86%D0%B8%D0%BE%D0%BD%D0%BD%D0%BE%D0%B3%D0%BE-%D0%BF%D0%BB%D0%B0%D0%B3%D0%B8%D0%BD%D0%B0) info
|
||||
|
||||
#### Local testing
|
||||
|
||||
To local testing run `docker-compose up`
|
||||
|
@ -11,6 +11,8 @@
|
||||
"minimum-stability": "dev",
|
||||
"require": {},
|
||||
"require-dev": {
|
||||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
"phpunit/phpunit": "6.*"
|
||||
}
|
||||
}
|
||||
|
34
docker-compose.yml
Normal file
34
docker-compose.yml
Normal file
@ -0,0 +1,34 @@
|
||||
version: '3'
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: ./.docker
|
||||
volumes:
|
||||
- ./:/code
|
||||
links:
|
||||
- "mysql"
|
||||
user: ${UID:-1000}:${GID:-1000}
|
||||
depends_on:
|
||||
- mysql
|
||||
entrypoint: make local_test
|
||||
env_file:
|
||||
- ./.env
|
||||
environment:
|
||||
- DB_NAME=${DB_NAME}
|
||||
- DB_USER=${DB_USER}
|
||||
- DB_PASS=${DB_PASS}
|
||||
- DB_HOST=${DB_HOST}
|
||||
- WP_VERSION=${WP_VERSION}
|
||||
- WC_VERSION=${WC_VERSION}
|
||||
- SKIP_DB_CREATE=true
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
env_file:
|
||||
- ./.env
|
||||
environment:
|
||||
- MYSQL_DATABASE=${DB_NAME}
|
||||
- MYSQL_USER=${DB_USER}
|
||||
- MYSQL_PASSWORD=${DB_PASS}
|
||||
- MYSQL_ROOT_PASSWORD=root
|
||||
ports:
|
||||
- "3306:3306"
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit
|
||||
bootstrap="tests/phpunit/bootstrap.php"
|
||||
bootstrap="tests/bootstrap.php"
|
||||
backupGlobals="false"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
@ -13,17 +13,21 @@
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Retailcrm WooCommerce Test Suite">
|
||||
<directory suffix=".php">tests/phpunit</directory>
|
||||
<directory suffix=".php">tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist addUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">src/include</directory>
|
||||
<directory suffix=".php">src</directory>
|
||||
<exclude>
|
||||
<directory suffix=".php">src/include/api</directory>
|
||||
<file>src/retailcrm.php</file>
|
||||
<file>src/uninstall.php</file>
|
||||
<directory>src/config</directory>
|
||||
<directory>src/languages</directory>
|
||||
<file>src/readme.txt</file>
|
||||
</exclude>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<logging>
|
||||
<log type="coverage-clover" target="coverage.xml"/>
|
||||
</logging>
|
||||
</phpunit>
|
@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
DIRECTORY=$(cd `dirname $0` && pwd)
|
||||
|
||||
msgfmt $DIRECTORY/../pot/retailcrm-ru_RU.pot -o $DIRECTORY/../../src/languages/retailcrm-ru_RU.mo
|
||||
msgfmt $DIRECTORY/../pot/retailcrm-es_ES.pot -o $DIRECTORY/../../src/languages/retailcrm-es_ES.mo
|
@ -353,13 +353,11 @@ 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) {
|
||||
|
||||
|
||||
|
||||
if ($order_item['variation_id'] != 0 ) {
|
||||
$offer_id = $order_item['variation_id'];
|
||||
} else {
|
||||
@ -670,7 +668,7 @@ if ( ! class_exists( 'WC_Retailcrm_History' ) ) :
|
||||
*/
|
||||
protected function editOrder($settings, $wc_order, $order, $event = 'create')
|
||||
{
|
||||
$order_items = [];
|
||||
$order_items = array();
|
||||
if ($event == 'update') {
|
||||
$result = $this->retailcrm->ordersGet($order['externalId']);
|
||||
if ($result->isSuccessful()) {
|
||||
@ -702,10 +700,10 @@ if ( ! class_exists( 'WC_Retailcrm_History' ) ) :
|
||||
}
|
||||
|
||||
if (!empty($order_items)) {
|
||||
$orderEdit = [
|
||||
$orderEdit = array(
|
||||
'id' => $order['id'],
|
||||
'items' => $order_items,
|
||||
];
|
||||
);
|
||||
|
||||
$this->retailcrm->ordersEdit($orderEdit, 'id');
|
||||
}
|
||||
|
@ -8,10 +8,11 @@ fi
|
||||
|
||||
DB_NAME=$1
|
||||
DB_USER=$2
|
||||
DB_PASS=$3
|
||||
DB_HOST=${4-localhost}
|
||||
WP_VERSION=${5-latest}
|
||||
SKIP_DB_CREATE=${6-false}
|
||||
DB_HOST=${3-localhost}
|
||||
WP_VERSION=${4-latest}
|
||||
WC_VERSION=${5-3.9.0}
|
||||
DB_PASS=${6-''}
|
||||
SKIP_DB_CREATE=${7-false}
|
||||
|
||||
WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib}
|
||||
WP_CORE_DIR=${WP_CORE_DIR-/tmp/wordpress/}
|
||||
@ -69,13 +70,29 @@ install_wp() {
|
||||
}
|
||||
|
||||
install_woocommerce() {
|
||||
if [[ ! -d "/tmp/woocommerce" ]]
|
||||
then
|
||||
cd /tmp
|
||||
git clone https://github.com/woocommerce/woocommerce.git
|
||||
cd woocommerce
|
||||
git checkout master
|
||||
composer install
|
||||
npm install
|
||||
|
||||
if [[ ! $WC_VERSION == 'latest' ]]; then
|
||||
git checkout $WC_VERSION
|
||||
|
||||
version=($(echo $WC_VERSION | tr "." "\n"))
|
||||
if [[ ${version[0]} -ge 3 && ${version[1]} -ge 7 ]]; then
|
||||
composer install
|
||||
# npm install
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $WC_VERSION == 'latest' ]]; then
|
||||
composer install
|
||||
# npm install
|
||||
fi
|
||||
|
||||
cd -
|
||||
fi
|
||||
}
|
||||
|
||||
install_test_suite() {
|
||||
@ -129,8 +146,10 @@ install_db() {
|
||||
fi
|
||||
fi
|
||||
|
||||
# create database
|
||||
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
|
||||
if [ ${DB_HOST} == "localhost" ]; then
|
||||
# create database
|
||||
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA --host=$DB_HOST
|
||||
fi
|
||||
}
|
||||
|
||||
install_wp
|
||||
|
@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ ${RUN_PHPCS} == 1 ]]; then
|
||||
composer install
|
||||
vendor/phpunit/phpunit/phpunit -c phpunit.xml.dist
|
||||
else
|
||||
phpunit -c phpunit.xml.dist
|
||||
fi
|
@ -9,7 +9,7 @@ if (!$_tests_dir) {
|
||||
require_once $_tests_dir . '/includes/functions.php';
|
||||
|
||||
function _manually_load_plugin() {
|
||||
$plugin_dir = dirname(dirname(dirname(__FILE__))) . '/';
|
||||
$plugin_dir = dirname(dirname(__FILE__)) . '/';
|
||||
|
||||
require $plugin_dir . 'src/include/class-wc-retailcrm-orders.php';
|
||||
require $plugin_dir . 'src/include/class-wc-retailcrm-customers.php';
|
||||
@ -24,7 +24,7 @@ tests_add_filter('muplugins_loaded', '_manually_load_plugin');
|
||||
|
||||
require '/tmp/woocommerce/tests/bootstrap.php';
|
||||
|
||||
$plugin_dir = dirname(dirname(dirname(__FILE__))) . '/';
|
||||
$plugin_dir = dirname(dirname(__FILE__)) . '/';
|
||||
// helpers
|
||||
require $plugin_dir . 'tests/helpers/class-wc-retailcrm-response-helper.php';
|
||||
require $plugin_dir . 'tests/helpers/class-wc-retailcrm-test-case-helper.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']);
|
||||
|
Loading…
x
Reference in New Issue
Block a user