mirror of
https://github.com/retailcrm/prestashop-module.git
synced 2025-03-01 10:53:14 +03:00
parent
c531f9b124
commit
31aafde3e5
@ -2,10 +2,9 @@ FROM php:7.2-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 unzip\
|
||||
RUN apt-get install -y zlib1g-dev libpq-dev git libicu-dev libxml2-dev libpng-dev libjpeg-dev libmcrypt-dev libxslt-dev libfreetype6-dev unzip nano\
|
||||
&& 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 \
|
||||
@ -18,14 +17,7 @@ RUN apt-get install -y zlib1g-dev libpq-dev git libicu-dev libxml2-dev libpng-de
|
||||
&& pecl install mcrypt-1.0.1 \
|
||||
&& docker-php-ext-enable mcrypt
|
||||
|
||||
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 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"
|
||||
RUN curl -sSL https://phar.phpunit.de/phpunit-6.phar -o /usr/bin/phpunit && chmod +x /usr/bin/phpunit \
|
||||
&& curl -sSL https://getcomposer.org/composer.phar -o /usr/bin/composer && chmod +x /usr/bin/composer
|
||||
|
||||
WORKDIR /code
|
22
.github/workflows/presta.yml
vendored
22
.github/workflows/presta.yml
vendored
@ -17,21 +17,19 @@ jobs:
|
||||
- php-version: '7.1'
|
||||
branch: '1.7.7.0'
|
||||
composerv1: 1
|
||||
phpunit-version: 'phpunit:6.4.3'
|
||||
- php-version: '7.2'
|
||||
branch: '1.7.7.0'
|
||||
composerv1: 1
|
||||
phpunit-version: 'phpunit:6.4.3'
|
||||
- php-version: '7.3'
|
||||
branch: '1.7.7.0'
|
||||
composerv1: 1
|
||||
- php-version: '7.1'
|
||||
branch: '1.7.7.8'
|
||||
composerv1: 1
|
||||
phpunit-version: 'phpunit:6.4.3'
|
||||
- php-version: '7.2'
|
||||
branch: '1.7.7.8'
|
||||
composerv1: 1
|
||||
branch: '1.7.8.10'
|
||||
coverage: 1
|
||||
phpunit-version: 'phpunit:6.4.3'
|
||||
|
||||
- php-version: '7.2'
|
||||
branch: '1.7.8.10'
|
||||
- php-version: '7.3'
|
||||
branch: '1.7.8.10'
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
@ -47,7 +45,7 @@ jobs:
|
||||
with:
|
||||
php-version: ${{ matrix.php-version }}
|
||||
coverage: xdebug
|
||||
tools: composer:v2, ${{ matrix.phpunit-version }}
|
||||
tools: composer:v2, phpunit:6.4.3
|
||||
extensions: gd, mbstring, zip, mcrypt, pdo_mysql, dom
|
||||
- name: Start mysql service
|
||||
run: sudo /etc/init.d/mysql start
|
||||
@ -60,7 +58,7 @@ jobs:
|
||||
BRANCH: ${{ matrix.branch }}
|
||||
COMPOSERV1: ${{ matrix.composerv1 }}
|
||||
MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }}
|
||||
run: make before_script
|
||||
run: make install_prestashop
|
||||
- name: Run tests
|
||||
env:
|
||||
BRANCH: ${{ matrix.branch }}
|
||||
|
@ -1,3 +1,6 @@
|
||||
## v3.6.1
|
||||
* Добавлены тесты для новых версий PrestaShop
|
||||
|
||||
## v3.6.0
|
||||
* Добавлена поддержка PrestaShop 1.7.8.10
|
||||
|
||||
|
68
Makefile
68
Makefile
@ -14,62 +14,34 @@ delete_archive:
|
||||
rm -f $(ARCHIVE_NAME)
|
||||
rm -f /tmp/retailcrm.zip
|
||||
|
||||
composer: clone_prestashop clone_composer fix-version-lang-bugs
|
||||
ifeq ($(COMPOSERV1),1)
|
||||
cd $(PRESTASHOP_DIR) && php composer.phar install --prefer-dist --no-interaction --no-progress
|
||||
else
|
||||
cd $(PRESTASHOP_DIR)/tests && composer install
|
||||
endif
|
||||
|
||||
clone_prestashop:
|
||||
cd $(ROOT_DIR)/../ && git clone https://github.com/PrestaShop/PrestaShop
|
||||
cd $(PRESTASHOP_DIR) && git checkout $(BRANCH)
|
||||
|
||||
clone_composer:
|
||||
# Required for versions 1.7.7.x - 1.7.8.x
|
||||
# Only this command work in Makefile for replace $sfContainer->get('translator')
|
||||
# sed -i 's/$$sfContainer->get('"'"'translator'"'"')/Context::getContext()->getTranslator()/g' classes/Language.php
|
||||
fix_lang_bugs:
|
||||
cd $(PRESTASHOP_DIR) && sed -i \
|
||||
-e "s/throw new Exception/#throw new Exception/g" \
|
||||
-e "s/SymfonyContainer::getInstance()->get('translator')/Context::getContext()->getTranslator()/g" \
|
||||
-e 's/$$sfContainer->get('"'"'translator'"'"')/Context::getContext()->getTranslator()/g' \
|
||||
src/PrestaShopBundle/Install/DatabaseDump.php classes/lang/DataLang.php classes/Language.php
|
||||
|
||||
install_composer:
|
||||
# Required for versions 1.7.7.x
|
||||
ifeq ($(COMPOSERV1),1)
|
||||
cd $(PRESTASHOP_DIR) \
|
||||
&& php -r "copy('https://getcomposer.org/download/1.10.17/composer.phar', 'composer.phar');"
|
||||
composer self-update --1
|
||||
endif
|
||||
cd $(PRESTASHOP_DIR) && composer install
|
||||
|
||||
before_script: composer
|
||||
ifneq ("$(wildcard $(PRESTASHOP_DIR)/travis-scripts/install-prestashop)","")
|
||||
ifeq ($(COMPOSERV1),1)
|
||||
cd $(PRESTASHOP_DIR) \
|
||||
&& sed -i 's/mysql -u root/mysql -u root --port $(MYSQL_PORT)/g' travis-scripts/install-prestashop \
|
||||
&& sed -i 's/--db_server=127.0.0.1 --db_name=prestashop/--db_server=127.0.0.1:$(MYSQL_PORT) --db_name=prestashop --db_user=root/g' travis-scripts/install-prestashop \
|
||||
&& bash travis-scripts/install-prestashop
|
||||
else
|
||||
cd $(PRESTASHOP_DIR) \
|
||||
&& sed -i 's/mysql -u root/mysql -u root -proot --port $(MYSQL_PORT)/g' travis-scripts/install-prestashop.sh \
|
||||
&& sed -i 's/--db_server=127.0.0.1 --db_name=prestashop/--db_server=127.0.0.1:$(MYSQL_PORT) --db_name=prestashop --db_user=root/g' travis-scripts/install-prestashop.sh \
|
||||
&& bash travis-scripts/install-prestashop.sh
|
||||
endif
|
||||
else
|
||||
rm -rf var/cache/*
|
||||
echo "* Installing PrestaShop, this may take a while ...";
|
||||
|
||||
install_prestashop: clone_prestashop fix_lang_bugs install_composer
|
||||
ifeq ($(LOCAL_TEST),1)
|
||||
cd $(PRESTASHOP_DIR) && php install-dev/index_cli.php --db_server=db --db_user=root --db_create=1
|
||||
else
|
||||
mkdir coverage
|
||||
cd $(PRESTASHOP_DIR) && php install-dev/index_cli.php --db_server=127.0.0.1:$(MYSQL_PORT) --db_user=root --db_create=1
|
||||
mkdir coverage
|
||||
endif
|
||||
endif
|
||||
|
||||
# Required for versions 1.7.7.x
|
||||
fix-version-lang-bugs:
|
||||
ifeq ($(COMPOSERV1),1)
|
||||
cd $(PRESTASHOP_DIR) \
|
||||
&& sed -i 's/throw new Exception/#throw new Exception/g' src/PrestaShopBundle/Install/DatabaseDump.php
|
||||
endif
|
||||
|
||||
cd $(PRESTASHOP_DIR) \
|
||||
&& sed -i "s/SymfonyContainer::getInstance()->get('translator')/\\\\Context::getContext()->getTranslator()/g" classes/lang/DataLang.php
|
||||
cat $(PRESTASHOP_DIR)/classes/lang/DataLang.php | grep -A 3 -B 3 'this->translator = '
|
||||
|
||||
cd $(PRESTASHOP_DIR) \
|
||||
&& sed -i "s/SymfonyContainer::getInstance()->get('translator')/\\\\Context::getContext()->getTranslator()/g" classes/Language.php
|
||||
cat $(PRESTASHOP_DIR)/classes/Language.php | grep -A 3 -B 3 'translator = '
|
||||
|
||||
lint:
|
||||
php-cs-fixer fix --config=$(ROOT_DIR)/.php-cs-fixer.php -v
|
||||
@ -77,11 +49,11 @@ lint:
|
||||
lint-docker:
|
||||
docker run --rm -it -w=/app -v ${PWD}:/app oskarstark/php-cs-fixer-ga:latest --config=.php-cs-fixer.php -v
|
||||
|
||||
# todo moveto version
|
||||
test:
|
||||
cd $(PRESTASHOP_DIR) && composer run-script create-test-db --timeout=0
|
||||
|
||||
ifeq ($(COMPOSERV1),1)
|
||||
cd $(PRESTASHOP_DIR) && php composer.phar run-script create-test-db --timeout=0
|
||||
cd $(PRESTASHOP_DIR) && php vendor/bin/phpunit -c $(ROOT_DIR)/phpunit.xml.dist
|
||||
phpunit -c $(ROOT_DIR)/phpunit.xml.dist
|
||||
else
|
||||
phpunit -c phpunit.xml.dist
|
||||
endif
|
||||
@ -91,5 +63,5 @@ coverage:
|
||||
|
||||
run_local_tests:
|
||||
docker-compose up -d --build
|
||||
docker exec app_test make before_script test
|
||||
docker exec app_prestashop_test make install_prestashop test
|
||||
docker-compose down
|
||||
|
@ -1,22 +1,19 @@
|
||||
version: '3'
|
||||
services:
|
||||
app:
|
||||
container_name: app_test
|
||||
container_name: app_prestashop_test
|
||||
build:
|
||||
context: ./.docker
|
||||
volumes:
|
||||
- ./:/code
|
||||
env_file:
|
||||
- ./.env
|
||||
environment:
|
||||
- BRANCH=${BRANCH}
|
||||
links:
|
||||
- db
|
||||
depends_on:
|
||||
- db
|
||||
db:
|
||||
container_name: mysql_prestashop_test
|
||||
image: mysql:5.7
|
||||
environment:
|
||||
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
|
||||
ports:
|
||||
- "3306:3306"
|
||||
- '3306:3306'
|
||||
|
@ -17,6 +17,9 @@
|
||||
<exclude>tests/helpers</exclude>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<php>
|
||||
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/>
|
||||
</php>
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">retailcrm</directory>
|
||||
|
@ -48,7 +48,7 @@ require_once dirname(__FILE__) . '/bootstrap.php';
|
||||
|
||||
class RetailCRM extends Module
|
||||
{
|
||||
const VERSION = '3.6.0';
|
||||
const VERSION = '3.6.1';
|
||||
|
||||
const API_URL = 'RETAILCRM_ADDRESS';
|
||||
const API_KEY = 'RETAILCRM_API_TOKEN';
|
||||
|
@ -496,6 +496,8 @@ class RetailcrmHistoryTest extends RetailcrmTestCase
|
||||
RetailcrmHistory::$api = $this->apiMock;
|
||||
|
||||
RetailcrmHistory::ordersHistory();
|
||||
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
public function testOrderAddressUpdate()
|
||||
|
Loading…
x
Reference in New Issue
Block a user