From 24ea74e21c942e9e21156aa2aa6182ba5b4a0e80 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Tue, 3 Mar 2020 17:50:26 +0300 Subject: [PATCH 01/26] update Makefile --- .travis.yml | 8 ++------ Makefile | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6acde29..32de372 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,13 +22,9 @@ matrix: - php: 7.1 env: BRANCH=1.6.1.x -before_script: - - bash tests/bin/clone_prestashop.sh - - bash tests/bin/setup-apache.sh - - bash tests/bin/before_script.sh +before_script: make before_script -script: - - bash tests/bin/script.sh +script: make test #deploy: # skip_cleanup: true diff --git a/Makefile b/Makefile index 24d104c..5cd3ab5 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +ROOT_DIR=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) +PRESTASHOP_DIR=$(ROOT_DIR)/../PrestaShop FILE = $(TRAVIS_BUILD_DIR)/VERSION VERSION = `cat $(FILE)` ARCHIVE_NAME = '/tmp/retailcrm-'$(VERSION)'.zip' @@ -15,3 +17,44 @@ send_to_ftp: delete_archive: rm -f $(ARCHIVE_NAME) rm -f /tmp/retailcrm.zip + +composer: clone_prestashop +ifeq ($(COMPOSER_IN_TESTS),1) + @cd $(ROOT_DIR)/../PrestaShop/tests && composer install +else + @cd $(ROOT_DIR)/../PrestaShop && composer install --prefer-dist --no-interaction --no-progress +endif + +clone_prestashop: + @cd $(ROOT_DIR)/.. && git clone https://github.com/PrestaShop/PrestaShop + +setup_apache: composer + @bash $(PRESTASHOP_DIR)/travis-scripts/setup-php-fpm.sh + @echo "* Preparing Apache ..." + @sudo a2enmod rewrite actions fastcgi alias + # Use default config + @sudo cp -f $(PRESTASHOP_DIR)/tests/travis-ci-apache-vhost /etc/apache2/sites-available/000-default.conf + @sudo sed -e "s?%PRESTASHOP_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf + @sudo chmod 777 -R $HOME + # Starting Apache + @sudo service apache2 restart + +before_script: setup_apache +ifeq ($(COMPOSER_IN_TESTS),1) + ifneq ("$(wildcard $(PRESTASHOP_DIR)/tests/parameters.yml.travis)","") + @cd $(PRESTASHOP_DIR) && cp tests/parameters.yml.travis app/config/parameters.yml + else + @cd $(PRESTASHOP_DIR) && cp tests-legacy/parameters.yml.travis app/config/parameters.yml + endif + @bash $(PRESTASHOP_DIR)/travis-scripts/install-prestashop +else + @bash $(PRESTASHOP_DIR)/travis-scripts/install-prestashop.sh +endif + +test: +ifeq ($(COMPOSER_IN_TESTS),1) + @phpunit +else + @cd $(PRESTASHOP_DIR) && composer run-script create-test-db --timeout=0 + @php $(PRESTASHOP_DIR)/vendor/bin/phpunit -c $(ROOT_DIR)/phpunit.xml.dist +endif From 9496591e8b9dd27c013f5234cdd33e09263137f2 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Tue, 3 Mar 2020 17:52:13 +0300 Subject: [PATCH 02/26] update travis config --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 32de372..6632ba1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,11 +16,11 @@ php: matrix: include: - php: 5.6 - env: BRANCH=1.6.1.x + env: BRANCH=1.6.1.x COMPOSER_IN_TESTS=1 - php: 7.0 - env: BRANCH=1.6.1.x + env: BRANCH=1.6.1.x COMPOSER_IN_TESTS=1 - php: 7.1 - env: BRANCH=1.6.1.x + env: BRANCH=1.6.1.x COMPOSER_IN_TESTS=1 before_script: make before_script From f62cc5053a753bfb36c43903715cf3b9c9393855 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Tue, 3 Mar 2020 17:56:13 +0300 Subject: [PATCH 03/26] update Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5cd3ab5..636df16 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ setup_apache: composer # Use default config @sudo cp -f $(PRESTASHOP_DIR)/tests/travis-ci-apache-vhost /etc/apache2/sites-available/000-default.conf @sudo sed -e "s?%PRESTASHOP_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf - @sudo chmod 777 -R $HOME + @sudo chmod 777 -R $(HOME) # Starting Apache @sudo service apache2 restart From 853b3d46ed034fe962c13d1139d93eccf338e48d Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Tue, 3 Mar 2020 18:02:52 +0300 Subject: [PATCH 04/26] update Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 636df16..06d95fc 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ else endif clone_prestashop: - @cd $(ROOT_DIR)/.. && git clone https://github.com/PrestaShop/PrestaShop + @cd $(ROOT_DIR)/../ && git clone https://github.com/PrestaShop/PrestaShop setup_apache: composer @bash $(PRESTASHOP_DIR)/travis-scripts/setup-php-fpm.sh From 5be30f29885323bf1bb7b009b7280e3703fb03a4 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Tue, 3 Mar 2020 18:12:53 +0300 Subject: [PATCH 05/26] update Makefile --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 06d95fc..f45dc99 100644 --- a/Makefile +++ b/Makefile @@ -46,9 +46,9 @@ ifeq ($(COMPOSER_IN_TESTS),1) else @cd $(PRESTASHOP_DIR) && cp tests-legacy/parameters.yml.travis app/config/parameters.yml endif - @bash $(PRESTASHOP_DIR)/travis-scripts/install-prestashop -else @bash $(PRESTASHOP_DIR)/travis-scripts/install-prestashop.sh +else + @bash $(PRESTASHOP_DIR)/travis-scripts/install-prestashop endif test: From 97b89357641f2bad86028e98c960a550ba1bcc3d Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Wed, 4 Mar 2020 09:42:59 +0300 Subject: [PATCH 06/26] update Makefile --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index f45dc99..067945e 100644 --- a/Makefile +++ b/Makefile @@ -46,9 +46,9 @@ ifeq ($(COMPOSER_IN_TESTS),1) else @cd $(PRESTASHOP_DIR) && cp tests-legacy/parameters.yml.travis app/config/parameters.yml endif - @bash $(PRESTASHOP_DIR)/travis-scripts/install-prestashop.sh + @cd $(PRESTASHOP_DIR) && bash travis-scripts/install-prestashop.sh else - @bash $(PRESTASHOP_DIR)/travis-scripts/install-prestashop + @cd $(PRESTASHOP_DIR) && bash travis-scripts/install-prestashop endif test: @@ -56,5 +56,5 @@ ifeq ($(COMPOSER_IN_TESTS),1) @phpunit else @cd $(PRESTASHOP_DIR) && composer run-script create-test-db --timeout=0 - @php $(PRESTASHOP_DIR)/vendor/bin/phpunit -c $(ROOT_DIR)/phpunit.xml.dist + @cd $(PRESTASHOP_DIR) && php vendor/bin/phpunit -c $(ROOT_DIR)/phpunit.xml.dist endif From 88f161fdc4416fa657976d20f8e927646b41a3d6 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Wed, 4 Mar 2020 09:48:30 +0300 Subject: [PATCH 07/26] update Makefile --- Makefile | 5 +++-- tests/bin/before_script.sh | 21 --------------------- tests/bin/clone_prestashop.sh | 19 ------------------- tests/bin/script.sh | 15 --------------- tests/bin/setup-apache.sh | 19 ------------------- 5 files changed, 3 insertions(+), 76 deletions(-) delete mode 100644 tests/bin/before_script.sh delete mode 100644 tests/bin/clone_prestashop.sh delete mode 100644 tests/bin/script.sh delete mode 100755 tests/bin/setup-apache.sh diff --git a/Makefile b/Makefile index 067945e..93e8f12 100644 --- a/Makefile +++ b/Makefile @@ -20,9 +20,10 @@ delete_archive: composer: clone_prestashop ifeq ($(COMPOSER_IN_TESTS),1) - @cd $(ROOT_DIR)/../PrestaShop/tests && composer install + @cd $(PRESTASHOP_DIR) && git checkout $(BRANCH) + @cd $(PRESTASHOP_DIR)/tests && composer install else - @cd $(ROOT_DIR)/../PrestaShop && composer install --prefer-dist --no-interaction --no-progress + @cd $(PRESTASHOP_DIR) && composer install --prefer-dist --no-interaction --no-progress endif clone_prestashop: diff --git a/tests/bin/before_script.sh b/tests/bin/before_script.sh deleted file mode 100644 index 0c5dacd..0000000 --- a/tests/bin/before_script.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -if [ -z $TRAVIS_BUILD_DIR ]; then - exit 0; -fi - -PRESTASHOP_DIR=$TRAVIS_BUILD_DIR/../PrestaShop - -cd $PRESTASHOP_DIR - -if [ -z $BRANCH ]; then - if [ -f "tests/parameters.yml.travis" ]; then - cp tests/parameters.yml.travis app/config/parameters.yml - else - cp tests-legacy/parameters.yml.travis app/config/parameters.yml - fi - - bash travis-scripts/install-prestashop -else - bash travis-scripts/install-prestashop.sh -fi diff --git a/tests/bin/clone_prestashop.sh b/tests/bin/clone_prestashop.sh deleted file mode 100644 index fde2403..0000000 --- a/tests/bin/clone_prestashop.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -if [ -z $TRAVIS_BUILD_DIR ]; then - exit 0; -fi - -PRESTASHOP_DIR=$TRAVIS_BUILD_DIR/../PrestaShop - -cd .. -git clone https://github.com/PrestaShop/PrestaShop -cd PrestaShop - -if ! [ -z $BRANCH ]; then - git checkout $BRANCH; - cd tests - composer install -else - composer install --prefer-dist --no-interaction --no-progress -fi diff --git a/tests/bin/script.sh b/tests/bin/script.sh deleted file mode 100644 index a104a9e..0000000 --- a/tests/bin/script.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -if [ -z $TRAVIS_BUILD_DIR ]; then - exit 0; -fi - -PRESTASHOP_DIR=$TRAVIS_BUILD_DIR/../PrestaShop - -if ! [ -z $BRANCH ]; then - phpunit -else - cd $PRESTASHOP_DIR - composer run-script create-test-db --timeout=0 - php ../PrestaShop/vendor/bin/phpunit -c $TRAVIS_BUILD_DIR/phpunit.xml.dist -fi diff --git a/tests/bin/setup-apache.sh b/tests/bin/setup-apache.sh deleted file mode 100755 index 42e93c2..0000000 --- a/tests/bin/setup-apache.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -PRESTASHOP_DIR=$TRAVIS_BUILD_DIR/../PrestaShop - -cd $PRESTASHOP_DIR - -bash travis-scripts/setup-php-fpm.sh - -echo "* Preparing Apache ..."; - -sudo a2enmod rewrite actions fastcgi alias - -# Use default config -sudo cp -f tests/travis-ci-apache-vhost /etc/apache2/sites-available/000-default.conf -sudo sed -e "s?%PRESTASHOP_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf -sudo chmod 777 -R $HOME - -# Starting Apache -sudo service apache2 restart From c3ead8a93cde42bb9422d02e93849e2682b99656 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Wed, 4 Mar 2020 09:56:48 +0300 Subject: [PATCH 08/26] update branch version --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6632ba1..3217714 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,11 +16,11 @@ php: matrix: include: - php: 5.6 - env: BRANCH=1.6.1.x COMPOSER_IN_TESTS=1 + env: BRANCH=1.6.1.1 COMPOSER_IN_TESTS=1 - php: 7.0 - env: BRANCH=1.6.1.x COMPOSER_IN_TESTS=1 + env: BRANCH=1.6.1.1 COMPOSER_IN_TESTS=1 - php: 7.1 - env: BRANCH=1.6.1.x COMPOSER_IN_TESTS=1 + env: BRANCH=1.6.1.1 COMPOSER_IN_TESTS=1 before_script: make before_script From 38ffafbbc0d00c19fbcdefac33cd482fc2288a61 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Wed, 4 Mar 2020 10:03:38 +0300 Subject: [PATCH 09/26] update branch version --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3217714..90365d5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,11 +16,11 @@ php: matrix: include: - php: 5.6 - env: BRANCH=1.6.1.1 COMPOSER_IN_TESTS=1 + env: BRANCH=1.6.1.24 COMPOSER_IN_TESTS=1 - php: 7.0 - env: BRANCH=1.6.1.1 COMPOSER_IN_TESTS=1 + env: BRANCH=1.6.1.24 COMPOSER_IN_TESTS=1 - php: 7.1 - env: BRANCH=1.6.1.1 COMPOSER_IN_TESTS=1 + env: BRANCH=1.6.1.24 COMPOSER_IN_TESTS=1 before_script: make before_script From 9fe976d13c07f40080968abc9b42ebf0362a1f67 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Wed, 4 Mar 2020 10:21:20 +0300 Subject: [PATCH 10/26] update Makefile --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 93e8f12..5063b2f 100644 --- a/Makefile +++ b/Makefile @@ -41,15 +41,15 @@ setup_apache: composer @sudo service apache2 restart before_script: setup_apache -ifeq ($(COMPOSER_IN_TESTS),1) +ifneq ($(COMPOSER_IN_TESTS),1) ifneq ("$(wildcard $(PRESTASHOP_DIR)/tests/parameters.yml.travis)","") @cd $(PRESTASHOP_DIR) && cp tests/parameters.yml.travis app/config/parameters.yml else @cd $(PRESTASHOP_DIR) && cp tests-legacy/parameters.yml.travis app/config/parameters.yml endif - @cd $(PRESTASHOP_DIR) && bash travis-scripts/install-prestashop.sh -else @cd $(PRESTASHOP_DIR) && bash travis-scripts/install-prestashop +else + @cd $(PRESTASHOP_DIR) && bash travis-scripts/install-prestashop.sh endif test: From 8eb5e83b11f61cdc67642eeb1214a25e1f1d58c7 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Wed, 4 Mar 2020 11:52:15 +0300 Subject: [PATCH 11/26] update travis config --- .travis.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 90365d5..c5ffe54 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ +os: linux + language: php addons: @@ -6,21 +8,20 @@ addons: - apache2 - libapache2-mod-fastcgi -sudo: required dist: trusty -php: - - 7.1 - - 7.2 - -matrix: +jobs: include: - - php: 5.6 - env: BRANCH=1.6.1.24 COMPOSER_IN_TESTS=1 - - php: 7.0 - env: BRANCH=1.6.1.24 COMPOSER_IN_TESTS=1 - - php: 7.1 - env: BRANCH=1.6.1.24 COMPOSER_IN_TESTS=1 + - php: 5.6 + env: BRANCH=1.6.1.24 COMPOSER_IN_TESTS=1 + - php: 7.0 + env: BRANCH=1.6.1.24 COMPOSER_IN_TESTS=1 + - php: 7.1 + env: BRANCH=1.6.1.24 COMPOSER_IN_TESTS=1 + - php: 7.1 + env: BRANCH=1.7.5.x + - php: 7.2 + env: BRANCH=1.7.5.x before_script: make before_script From f4c8000c8df0a07ac1edcbc721fa241c934e84f0 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Wed, 4 Mar 2020 12:09:24 +0300 Subject: [PATCH 12/26] update travis config --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5063b2f..6154a8b 100644 --- a/Makefile +++ b/Makefile @@ -19,8 +19,8 @@ delete_archive: rm -f /tmp/retailcrm.zip composer: clone_prestashop -ifeq ($(COMPOSER_IN_TESTS),1) @cd $(PRESTASHOP_DIR) && git checkout $(BRANCH) +ifeq ($(COMPOSER_IN_TESTS),1) @cd $(PRESTASHOP_DIR)/tests && composer install else @cd $(PRESTASHOP_DIR) && composer install --prefer-dist --no-interaction --no-progress From 4d94b95b9e18b427e87c7b0c9bfadcc5ddb77eab Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Wed, 4 Mar 2020 12:16:05 +0300 Subject: [PATCH 13/26] update travis config --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6154a8b..b073c5e 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ setup_apache: composer before_script: setup_apache ifneq ($(COMPOSER_IN_TESTS),1) - ifneq ("$(wildcard $(PRESTASHOP_DIR)/tests/parameters.yml.travis)","") + ifeq ("$(wildcard $(PRESTASHOP_DIR)/tests/parameters.yml.travis)","") @cd $(PRESTASHOP_DIR) && cp tests/parameters.yml.travis app/config/parameters.yml else @cd $(PRESTASHOP_DIR) && cp tests-legacy/parameters.yml.travis app/config/parameters.yml From 596d6f0b76cb7b45a004d23e1f108994401fe185 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Wed, 4 Mar 2020 12:26:14 +0300 Subject: [PATCH 14/26] alias for legacy tests --- tests/helpers/RetailcrmTestCase.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/helpers/RetailcrmTestCase.php b/tests/helpers/RetailcrmTestCase.php index fd242bb..576a498 100644 --- a/tests/helpers/RetailcrmTestCase.php +++ b/tests/helpers/RetailcrmTestCase.php @@ -1,5 +1,9 @@ ')) { - $contextMocker = new \LegacyTests\Unit\ContextMocker(); + $contextMocker = new \Tests\Unit\ContextMocker(); $this->contextMock = $contextMocker->mockContext(); } } From c2ceac1a4a7341257d4544f6f33a34b48e23b3eb Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Wed, 4 Mar 2020 17:01:50 +0300 Subject: [PATCH 15/26] update matrix --- .travis.yml | 43 +++++++++++++++++++++++++++++++++++++++++++ Makefile | 30 +++++++++++++++--------------- 2 files changed, 58 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index c5ffe54..26b3e41 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,12 +12,55 @@ dist: trusty jobs: include: + - php: 5.6 + env: BRANCH=1.6.1.18 COMPOSER_IN_TESTS=1 + - php: 7.0 + env: BRANCH=1.6.1.18 COMPOSER_IN_TESTS=1 + - php: 7.1 + env: BRANCH=1.6.1.18 COMPOSER_IN_TESTS=1 + + - php: 5.6 + env: BRANCH=1.6.1.19 COMPOSER_IN_TESTS=1 + - php: 7.0 + env: BRANCH=1.6.1.19 COMPOSER_IN_TESTS=1 + - php: 7.1 + env: BRANCH=1.6.1.19 COMPOSER_IN_TESTS=1 + + - php: 5.6 + env: BRANCH=1.6.1.20 COMPOSER_IN_TESTS=1 + - php: 7.0 + env: BRANCH=1.6.1.20 COMPOSER_IN_TESTS=1 + - php: 7.1 + env: BRANCH=1.6.1.20 COMPOSER_IN_TESTS=1 + + - php: 5.6 + env: BRANCH=1.6.1.21 COMPOSER_IN_TESTS=1 + - php: 7.0 + env: BRANCH=1.6.1.21 COMPOSER_IN_TESTS=1 + - php: 7.1 + env: BRANCH=1.6.1.21 COMPOSER_IN_TESTS=1 + + - php: 5.6 + env: BRANCH=1.6.1.22 COMPOSER_IN_TESTS=1 + - php: 7.0 + env: BRANCH=1.6.1.22 COMPOSER_IN_TESTS=1 + - php: 7.1 + env: BRANCH=1.6.1.22 COMPOSER_IN_TESTS=1 + + - php: 5.6 + env: BRANCH=1.6.1.23 COMPOSER_IN_TESTS=1 + - php: 7.0 + env: BRANCH=1.6.1.23 COMPOSER_IN_TESTS=1 + - php: 7.1 + env: BRANCH=1.6.1.23 COMPOSER_IN_TESTS=1 + - php: 5.6 env: BRANCH=1.6.1.24 COMPOSER_IN_TESTS=1 - php: 7.0 env: BRANCH=1.6.1.24 COMPOSER_IN_TESTS=1 - php: 7.1 env: BRANCH=1.6.1.24 COMPOSER_IN_TESTS=1 + - php: 7.1 env: BRANCH=1.7.5.x - php: 7.2 diff --git a/Makefile b/Makefile index b073c5e..82aa8f4 100644 --- a/Makefile +++ b/Makefile @@ -27,35 +27,35 @@ else endif clone_prestashop: - @cd $(ROOT_DIR)/../ && git clone https://github.com/PrestaShop/PrestaShop + cd $(ROOT_DIR)/../ && git clone https://github.com/PrestaShop/PrestaShop setup_apache: composer - @bash $(PRESTASHOP_DIR)/travis-scripts/setup-php-fpm.sh - @echo "* Preparing Apache ..." - @sudo a2enmod rewrite actions fastcgi alias + bash $(PRESTASHOP_DIR)/travis-scripts/setup-php-fpm.sh + echo "* Preparing Apache ..." + sudo a2enmod rewrite actions fastcgi alias # Use default config - @sudo cp -f $(PRESTASHOP_DIR)/tests/travis-ci-apache-vhost /etc/apache2/sites-available/000-default.conf - @sudo sed -e "s?%PRESTASHOP_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf - @sudo chmod 777 -R $(HOME) + sudo cp -f $(PRESTASHOP_DIR)/tests/travis-ci-apache-vhost /etc/apache2/sites-available/000-default.conf + sudo sed -e "s?%PRESTASHOP_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf + sudo chmod 777 -R $(HOME) # Starting Apache - @sudo service apache2 restart + sudo service apache2 restart before_script: setup_apache ifneq ($(COMPOSER_IN_TESTS),1) ifeq ("$(wildcard $(PRESTASHOP_DIR)/tests/parameters.yml.travis)","") - @cd $(PRESTASHOP_DIR) && cp tests/parameters.yml.travis app/config/parameters.yml + cd $(PRESTASHOP_DIR) && cp tests/parameters.yml.travis app/config/parameters.yml else - @cd $(PRESTASHOP_DIR) && cp tests-legacy/parameters.yml.travis app/config/parameters.yml + cd $(PRESTASHOP_DIR) && cp tests-legacy/parameters.yml.travis app/config/parameters.yml endif - @cd $(PRESTASHOP_DIR) && bash travis-scripts/install-prestashop + cd $(PRESTASHOP_DIR) && bash travis-scripts/install-prestashop else - @cd $(PRESTASHOP_DIR) && bash travis-scripts/install-prestashop.sh + cd $(PRESTASHOP_DIR) && bash travis-scripts/install-prestashop.sh endif test: ifeq ($(COMPOSER_IN_TESTS),1) - @phpunit + phpunit else - @cd $(PRESTASHOP_DIR) && composer run-script create-test-db --timeout=0 - @cd $(PRESTASHOP_DIR) && php vendor/bin/phpunit -c $(ROOT_DIR)/phpunit.xml.dist + cd $(PRESTASHOP_DIR) && composer run-script create-test-db --timeout=0 + cd $(PRESTASHOP_DIR) && php vendor/bin/phpunit -c $(ROOT_DIR)/phpunit.xml.dist endif From e3ec1b05180db2820708f6db26851b0c3f185765 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Wed, 4 Mar 2020 17:08:43 +0300 Subject: [PATCH 16/26] delete phpunit dir --- tests/{phpunit => }/RetailcrmCatalogTest.php | 0 .../RetailcrmDaemonCollectorTest.php | 0 tests/{phpunit => }/RetailcrmHistoryTest.php | 0 .../{phpunit => }/RetailcrmInventoriesTest.php | 0 .../{phpunit => }/RetailcrmReferencesTest.php | 0 tests/{phpunit => }/RetailcrmTest.php | 0 tests/bootstrap.php | 18 ++++++++++++++++++ tests/phpunit/bootstrap.php | 18 ------------------ 8 files changed, 18 insertions(+), 18 deletions(-) rename tests/{phpunit => }/RetailcrmCatalogTest.php (100%) rename tests/{phpunit => }/RetailcrmDaemonCollectorTest.php (100%) rename tests/{phpunit => }/RetailcrmHistoryTest.php (100%) rename tests/{phpunit => }/RetailcrmInventoriesTest.php (100%) rename tests/{phpunit => }/RetailcrmReferencesTest.php (100%) rename tests/{phpunit => }/RetailcrmTest.php (100%) create mode 100644 tests/bootstrap.php delete mode 100644 tests/phpunit/bootstrap.php diff --git a/tests/phpunit/RetailcrmCatalogTest.php b/tests/RetailcrmCatalogTest.php similarity index 100% rename from tests/phpunit/RetailcrmCatalogTest.php rename to tests/RetailcrmCatalogTest.php diff --git a/tests/phpunit/RetailcrmDaemonCollectorTest.php b/tests/RetailcrmDaemonCollectorTest.php similarity index 100% rename from tests/phpunit/RetailcrmDaemonCollectorTest.php rename to tests/RetailcrmDaemonCollectorTest.php diff --git a/tests/phpunit/RetailcrmHistoryTest.php b/tests/RetailcrmHistoryTest.php similarity index 100% rename from tests/phpunit/RetailcrmHistoryTest.php rename to tests/RetailcrmHistoryTest.php diff --git a/tests/phpunit/RetailcrmInventoriesTest.php b/tests/RetailcrmInventoriesTest.php similarity index 100% rename from tests/phpunit/RetailcrmInventoriesTest.php rename to tests/RetailcrmInventoriesTest.php diff --git a/tests/phpunit/RetailcrmReferencesTest.php b/tests/RetailcrmReferencesTest.php similarity index 100% rename from tests/phpunit/RetailcrmReferencesTest.php rename to tests/RetailcrmReferencesTest.php diff --git a/tests/phpunit/RetailcrmTest.php b/tests/RetailcrmTest.php similarity index 100% rename from tests/phpunit/RetailcrmTest.php rename to tests/RetailcrmTest.php diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..fb75d62 --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,18 @@ +install(); diff --git a/tests/phpunit/bootstrap.php b/tests/phpunit/bootstrap.php deleted file mode 100644 index d96e7f1..0000000 --- a/tests/phpunit/bootstrap.php +++ /dev/null @@ -1,18 +0,0 @@ -install(); From b15be0d7dddc61546469b1c5a5ae5603eda70da4 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Wed, 4 Mar 2020 17:33:28 +0300 Subject: [PATCH 17/26] update phpunit config --- phpunit.xml.dist | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index c76fd75..08ad0ef 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,6 +1,6 @@ - - tests/phpunit + + tests + tests/helpers - + retailcrm retailcrm/translations - retailcrm/job bootstrap.php index.php logo.gif From 4a468344f9a0bb0b4239c0dff706cdce9b8b31a6 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Wed, 4 Mar 2020 17:59:20 +0300 Subject: [PATCH 18/26] update phpunit config --- .travis.yml | 1 + Makefile | 4 ++-- phpunit.xml.dist | 3 +++ tests/bootstrap.php | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 26b3e41..074ae4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,6 +65,7 @@ jobs: env: BRANCH=1.7.5.x - php: 7.2 env: BRANCH=1.7.5.x + after_success: bash <(curl -s https://codecov.io/bash) before_script: make before_script diff --git a/Makefile b/Makefile index 82aa8f4..65aee33 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ delete_archive: rm -f $(ARCHIVE_NAME) rm -f /tmp/retailcrm.zip -composer: clone_prestashop +composer: @cd $(PRESTASHOP_DIR) && git checkout $(BRANCH) ifeq ($(COMPOSER_IN_TESTS),1) @cd $(PRESTASHOP_DIR)/tests && composer install @@ -56,6 +56,6 @@ test: ifeq ($(COMPOSER_IN_TESTS),1) phpunit else - cd $(PRESTASHOP_DIR) && composer run-script create-test-db --timeout=0 +# cd $(PRESTASHOP_DIR) && composer run-script create-test-db --timeout=0 cd $(PRESTASHOP_DIR) && php vendor/bin/phpunit -c $(ROOT_DIR)/phpunit.xml.dist endif diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 08ad0ef..029c9de 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -30,4 +30,7 @@ + + + \ No newline at end of file diff --git a/tests/bootstrap.php b/tests/bootstrap.php index fb75d62..c2cafba 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,6 +1,6 @@ Date: Wed, 4 Mar 2020 18:04:06 +0300 Subject: [PATCH 19/26] update Makefile --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 65aee33..82aa8f4 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ delete_archive: rm -f $(ARCHIVE_NAME) rm -f /tmp/retailcrm.zip -composer: +composer: clone_prestashop @cd $(PRESTASHOP_DIR) && git checkout $(BRANCH) ifeq ($(COMPOSER_IN_TESTS),1) @cd $(PRESTASHOP_DIR)/tests && composer install @@ -56,6 +56,6 @@ test: ifeq ($(COMPOSER_IN_TESTS),1) phpunit else -# cd $(PRESTASHOP_DIR) && composer run-script create-test-db --timeout=0 + cd $(PRESTASHOP_DIR) && composer run-script create-test-db --timeout=0 cd $(PRESTASHOP_DIR) && php vendor/bin/phpunit -c $(ROOT_DIR)/phpunit.xml.dist endif From a489fe2f5844cf994001887da5eeb44854f10263 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Wed, 4 Mar 2020 22:58:57 +0300 Subject: [PATCH 20/26] test --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 074ae4a..2e03c32 100644 --- a/.travis.yml +++ b/.travis.yml @@ -69,7 +69,7 @@ jobs: before_script: make before_script -script: make test +script: phpunit #deploy: # skip_cleanup: true From 7daa69fc176d7ddfb5af2e37a2bdc0a0ff3b5223 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Wed, 4 Mar 2020 23:16:19 +0300 Subject: [PATCH 21/26] test --- .travis.yml | 12 +++++++----- Makefile | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2e03c32..8d951b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ os: linux +dist: trusty language: php @@ -8,7 +9,12 @@ addons: - apache2 - libapache2-mod-fastcgi -dist: trusty +before_script: make before_script + +script: make test + +stages: + - test jobs: include: @@ -67,10 +73,6 @@ jobs: env: BRANCH=1.7.5.x after_success: bash <(curl -s https://codecov.io/bash) -before_script: make before_script - -script: phpunit - #deploy: # skip_cleanup: true # provider: script diff --git a/Makefile b/Makefile index 82aa8f4..95b3f69 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,7 @@ endif test: ifeq ($(COMPOSER_IN_TESTS),1) - phpunit + phpunit -c phpunit.xml.dist else cd $(PRESTASHOP_DIR) && composer run-script create-test-db --timeout=0 cd $(PRESTASHOP_DIR) && php vendor/bin/phpunit -c $(ROOT_DIR)/phpunit.xml.dist From 243b170fa7708bc7d7784895095a561084a78a34 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Wed, 4 Mar 2020 23:30:02 +0300 Subject: [PATCH 22/26] test --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 95b3f69..ff53cfc 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ endif clone_prestashop: cd $(ROOT_DIR)/../ && git clone https://github.com/PrestaShop/PrestaShop -setup_apache: composer +setup_apache: bash $(PRESTASHOP_DIR)/travis-scripts/setup-php-fpm.sh echo "* Preparing Apache ..." sudo a2enmod rewrite actions fastcgi alias @@ -40,7 +40,7 @@ setup_apache: composer # Starting Apache sudo service apache2 restart -before_script: setup_apache +before_script: composer ifneq ($(COMPOSER_IN_TESTS),1) ifeq ("$(wildcard $(PRESTASHOP_DIR)/tests/parameters.yml.travis)","") cd $(PRESTASHOP_DIR) && cp tests/parameters.yml.travis app/config/parameters.yml From 7b7719e5806ce20ed71b21798acc825f9c2fe511 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Wed, 4 Mar 2020 23:37:17 +0300 Subject: [PATCH 23/26] fix require path --- .docker/Dockerfile | 30 ++++++++++++++++++++++++++++++ docker-compose.yml | 25 +++++++++++++++++++++++++ tests/bootstrap.php | 8 ++++---- 3 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 .docker/Dockerfile create mode 100644 docker-compose.yml diff --git a/.docker/Dockerfile b/.docker/Dockerfile new file mode 100644 index 0000000..81e772e --- /dev/null +++ b/.docker/Dockerfile @@ -0,0 +1,30 @@ +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 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 + +# Set timezone +RUN rm /etc/localtime +RUN ln -s /usr/share/zoneinfo/Europe/Moscow /etc/localtime +RUN "date" + +WORKDIR /code \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1650564 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3' +services: + app: + build: + context: ./.docker + volumes: + - ./:/code + links: + - "mysql" + depends_on: + - mysql + environment: + - DB_NAME=presta + - DB_USER=presta + - DB_PASS=presta + - DB_HOST=presta + mysql: + image: mysql:5.7 + environment: + - MYSQL_DATABASE=presta + - MYSQL_USER=presta + - MYSQL_PASSWORD=presta + - MYSQL_ROOT_PASSWORD=root + ports: + - "3306:3306" \ No newline at end of file diff --git a/tests/bootstrap.php b/tests/bootstrap.php index c2cafba..2ba3461 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -6,11 +6,11 @@ if (file_exists(__DIR__ . '/../../PrestaShop/tests-legacy')) { require_once __DIR__ . '/../../PrestaShop/tests/bootstrap.php'; } -require_once dirname(__DIR__) . '../../PrestaShop/config/config.inc.php'; -require_once dirname(__DIR__) . '../../PrestaShop/config/defines_uri.inc.php'; -require_once dirname(__DIR__) . '../retailcrm/bootstrap.php'; +require_once __DIR__ . '/../../PrestaShop/config/config.inc.php'; +require_once __DIR__ . '/../../PrestaShop/config/defines_uri.inc.php'; +require_once __DIR__ . '/../retailcrm/bootstrap.php'; require_once __DIR__ . '/../retailcrm/retailcrm.php'; -require_once dirname(__DIR__) . '../../PrestaShop/init.php'; +require_once __DIR__ . '/../../PrestaShop/init.php'; require_once __DIR__ . '/helpers/RetailcrmTestCase.php'; require_once __DIR__ . '/helpers/RetailcrmTestHelper.php'; From 77ecd15b45ab8ba55260f185fc00a5640117e67b Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Wed, 4 Mar 2020 23:55:28 +0300 Subject: [PATCH 24/26] update matrix --- .travis.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8d951b4..d1fb684 100644 --- a/.travis.yml +++ b/.travis.yml @@ -67,6 +67,31 @@ jobs: - php: 7.1 env: BRANCH=1.6.1.24 COMPOSER_IN_TESTS=1 + - php: 7.1 + env: BRANCH=1.7.0.0 + - php: 7.2 + env: BRANCH=1.7.0.0 + + - php: 7.1 + env: BRANCH=1.7.1.0 + - php: 7.2 + env: BRANCH=1.7.1.0 + + - php: 7.1 + env: BRANCH=1.7.2.0 + - php: 7.2 + env: BRANCH=1.7.2.0 + + - php: 7.1 + env: BRANCH=1.7.3.0 + - php: 7.2 + env: BRANCH=1.7.3.0 + + - php: 7.1 + env: BRANCH=1.7.4.0 + - php: 7.2 + env: BRANCH=1.7.4.0 + - php: 7.1 env: BRANCH=1.7.5.x - php: 7.2 From 91341084d5e37076261ec6f07dfa1f7209b8f2b8 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Thu, 5 Mar 2020 09:43:41 +0300 Subject: [PATCH 25/26] fix matrix --- .travis.yml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index d1fb684..8d6ba47 100644 --- a/.travis.yml +++ b/.travis.yml @@ -67,21 +67,6 @@ jobs: - php: 7.1 env: BRANCH=1.6.1.24 COMPOSER_IN_TESTS=1 - - php: 7.1 - env: BRANCH=1.7.0.0 - - php: 7.2 - env: BRANCH=1.7.0.0 - - - php: 7.1 - env: BRANCH=1.7.1.0 - - php: 7.2 - env: BRANCH=1.7.1.0 - - - php: 7.1 - env: BRANCH=1.7.2.0 - - php: 7.2 - env: BRANCH=1.7.2.0 - - php: 7.1 env: BRANCH=1.7.3.0 - php: 7.2 From de10b753794e22b734ed9b5c00b16d2be056d67e Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Thu, 5 Mar 2020 10:41:50 +0300 Subject: [PATCH 26/26] update deploy --- .travis.yml | 39 ++++++++++++++++++++++++++------------- Makefile | 6 +----- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8d6ba47..f1a7767 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,18 +3,25 @@ dist: trusty language: php +if: tag IS blank + addons: apt: packages: - apache2 - libapache2-mod-fastcgi +before_install: + - export LAST_TAG=`git describe --abbrev=0 --tags` + - export CURRENT_VERSION=v`cat VERSION` + before_script: make before_script script: make test stages: - test + - deploy jobs: include: @@ -67,11 +74,6 @@ jobs: - php: 7.1 env: BRANCH=1.6.1.24 COMPOSER_IN_TESTS=1 - - php: 7.1 - env: BRANCH=1.7.3.0 - - php: 7.2 - env: BRANCH=1.7.3.0 - - php: 7.1 env: BRANCH=1.7.4.0 - php: 7.2 @@ -83,11 +85,22 @@ jobs: env: BRANCH=1.7.5.x after_success: bash <(curl -s https://codecov.io/bash) -#deploy: -# skip_cleanup: true -# provider: script -# script: make -# on: -# php: 7.2 -# branch: master -# condition: "$DEPLOY = true" + - stage: deploy + before_script: skip + script: make build_archive + before_deploy: + - export VERSION=`cat VERSION` + - export ARCHIVE_NAME=/tmp/retailcrm-$VERSION.zip + - 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 + file: $ARCHIVE_NAME + on: + condition: "$LAST_TAG != $CURRENT_VERSION" + if: branch = master AND type = push AND fork = false + after_deploy: make delete_archive diff --git a/Makefile b/Makefile index ff53cfc..0a58232 100644 --- a/Makefile +++ b/Makefile @@ -4,16 +4,12 @@ FILE = $(TRAVIS_BUILD_DIR)/VERSION VERSION = `cat $(FILE)` ARCHIVE_NAME = '/tmp/retailcrm-'$(VERSION)'.zip' -all: build_archive send_to_ftp delete_archive +.PHONY: build_archive delete_archive build_archive: zip -r $(ARCHIVE_NAME) ./retailcrm/* zip -r /tmp/retailcrm.zip ./retailcrm/* -send_to_ftp: - curl -T $(ARCHIVE_NAME) -u $(FTP_USER):$(FTP_PASSWORD) ftp://$(FTP_HOST) - curl -T /tmp/retailcrm.zip -u $(FTP_USER):$(FTP_PASSWORD) ftp://$(FTP_HOST) - delete_archive: rm -f $(ARCHIVE_NAME) rm -f /tmp/retailcrm.zip