From f50a102cc8cc93663b7da39a323b1462486d4544 Mon Sep 17 00:00:00 2001 From: Eugene Polozov Date: Thu, 17 Dec 2020 11:13:11 +0300 Subject: [PATCH] Rebranding RetailCRM, fix tests --- .travis.yml | 6 +- CHANGELOG.md | 7 +- README.md | 6 +- README.ru.md | 21 ++---- VERSION | 2 +- bin/install.sh | 66 ++++++++++--------- src/Console/Command/CustomersExport.php | 4 +- src/Console/Command/OrdersExport.php | 4 +- src/Model/Config/Backend/ApiUrl.php | 2 +- src/Model/Config/Backend/ApiVersion.php | 2 +- src/Model/Service/Customer.php | 8 ++- src/README.md | 2 +- src/Test/Helpers/FieldsetTest.php | 21 +++++- .../Config/Form/Fieldset/PaymentTest.php | 3 +- .../Config/Form/Fieldset/ShippingTest.php | 3 +- .../System/Config/Form/Fieldset/SiteTest.php | 3 +- .../System/Config/Form/Fieldset/SitesTest.php | 3 +- .../Config/Form/Fieldset/StatusTest.php | 3 +- src/composer.json | 2 +- src/etc/adminhtml/system.xml | 4 +- src/i18n/es_ES.csv | 6 +- src/i18n/ru_RU.csv | 6 +- 22 files changed, 101 insertions(+), 83 deletions(-) diff --git a/.travis.yml b/.travis.yml index d4a9120..5443c3f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -237,13 +237,9 @@ jobs: env: BRANCH=2.3.3 - php: 7.2 env: BRANCH=2.3.3 - - php: 7.3 - env: BRANCH=2.3.3 - php: 7.2 env: BRANCH=2.3.4 - - php: 7.3 - env: BRANCH=2.3.4 - stage: deploy before_script: skip @@ -251,7 +247,7 @@ jobs: before_deploy: - export VERSION=`cat VERSION` - export ARCHIVE_NAME=/tmp/retailcrm-retailcrm-$VERSION.zip - - git config --local user.name "retailCRM" + - git config --local user.name "RetailCRM" - git config --local user.email "support@retailcrm.ru" - export TRAVIS_TAG=v$VERSION - git tag $TRAVIS_TAG diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cbd1fd..849a553 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2020-12-17 v.2.5.1 +* Ребрендинг RetailCRM + ## 2018-12-25 v.2.5.0 * Поддержка передачи в заказе нескольких позиций одного товара @@ -5,13 +8,13 @@ * Удалена генерация externalId покупателя при заказе от незарегестрированного пользователя ## 2018-12-25 v.2.4.0 -* Добавлен функционал получения остатков из retailCRM +* Добавлен функционал получения остатков из RetailCRM ## 2018-12-25 v.2.3.2 * Добавлена выгрузка картинок категорий товаров в ICML ## 2018-10-25 v.2.3.1 -* Добавлена активация модуля в маркетплейсе retailCRM +* Добавлена активация модуля в маркетплейсе RetailCRM ## 2018-08-21 v.2.3.0 * Добавлены консольные команды для выгрузки архива клиентов и заказов diff --git a/README.md b/README.md index 123a00b..1628399 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,13 @@ Magento module ============== -Magento 2 module for interaction with [retailCRM](http://www.retailcrm.ru). +Magento 2 module for interaction with [RetailCRM](http://www.retailcrm.ru) ([Documentation](https://docs.retailcrm.pro/Users/Integration/SiteModules/Magento) page) Module allows: -* Exchange the orders data with retailCRM +* Exchange the orders data with RetailCRM * Configure relations between dictionaries of retailCRM and Magento (statuses, payments, delivery types and etc) -* Generate [ICML](http://www.retailcrm.ru/docs/Developers/ICML) (Intaro Markup Language) export file for catalog loading by retailCRM +* Generate [ICML](http://www.retailcrm.ru/docs/Developers/ICML) (Intaro Markup Language) export file for catalog loading by RetailCRM ## ICML diff --git a/README.ru.md b/README.ru.md index 6bc4bbf..20b0b16 100644 --- a/README.ru.md +++ b/README.ru.md @@ -1,27 +1,16 @@ Magento module -Модуль Magento 2 для интеграции с [retailCRM](http://www.retailcrm.ru). +Модуль Magento 2 для интеграции с [RetailCRM](http://www.retailcrm.ru) ([Документация](https://docs.retailcrm.ru/Users/Integration/SiteModules/Magento)) Модуль позволяет: -* Производить обмен заказами с retailCRM -* Настроить соответствие справочников retailCRM и Magento (статусы, оплаты, типы доставки и т.д.) -* Создать [ICML](http://www.retailcrm.ru/docs/Developers/ICML) (Intaro Markup Language) для загрузки каталога товаров в retailCRM - -### ICML - -По умолчанию ICML-файл генерируется модулем каждые 4 часа. Вы можете найти файл в корневой директории с именем «retailcrm_{{shop_code}}.xml". Например, http://example.org/retailcrm_default.xml - -### Ручная установка - -1) Находясь в корневой директории проекта выполните команду: - -* Настроить соответствие справочников retailCRM и Magento (статусы, оплаты, типы доставки и т.д.) -* Создать [ICML] (http://www.retailcrm.ru/docs/Developers/ICML) (Intaro Markup Language) для загрузки каталога товаров в RetailCRM +* Производить обмен заказами с RetailCRM +* Настроить соответствие справочников RetailCRM и Magento (статусы, оплаты, типы доставки и т.д.) +* Создать [ICML](http://www.retailcrm.ru/docs/Developers/ICML) (Intaro Markup Language) для загрузки каталога товаров в RetailCRM ## ICML -По умолчанию ICML-файл генерируется модулем каждые 4 часа. Вы можете найти файл в корневой папке с именем «retailcrm_{{shop_code}}.xml". Например, http://retailcrm.ru/retailcrm_default.xml +По умолчанию ICML-файл генерируется модулем каждые 4 часа. Вы можете найти файл в корневой папке с именем «retailcrm_{{shop_code}}.xml". Например, http://example.ru/retailcrm_default.xml ## Ручная установка diff --git a/VERSION b/VERSION index 437459c..73462a5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.5.0 +2.5.1 diff --git a/bin/install.sh b/bin/install.sh index a17938c..49c9c77 100644 --- a/bin/install.sh +++ b/bin/install.sh @@ -1,23 +1,23 @@ #!/usr/bin/env bash if [ -z $TRAVIS_BUILD_DIR ]; then - exit 0; + exit 0; fi MAGE_ROOT=$TRAVIS_BUILD_DIR/../magento2 create_db() { - mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS" + mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS" } magento_clone() { - cd .. - git clone https://github.com/magento/magento2 - cd magento2 - git checkout $BRANCH + cd .. + git clone https://github.com/magento/magento2 + cd magento2 + git checkout $BRANCH - touch auth.json - echo ' + touch auth.json + echo ' { "http-basic": { "repo.magento.com": { @@ -26,40 +26,42 @@ magento_clone() { } } } - ' > auth.json + ' > auth.json - sudo sed -e "s??$PUBLIC_KEY?g" --in-place auth.json - sudo sed -e "s??$PRIVATE_KEY?g" --in-place auth.json + sudo sed -e "s??$PUBLIC_KEY?g" --in-place auth.json + sudo sed -e "s??$PRIVATE_KEY?g" --in-place auth.json - composer install --no-interaction --prefer-dist - composer require retailcrm/api-client-php + php -r "copy('https://getcomposer.org/download/1.10.17/composer.phar', 'composer.phar');" + + php composer.phar install --ignore-platform-reqs --no-interaction --prefer-dist + php composer.phar require retailcrm/api-client-php } magento_install() { - cd $MAGE_ROOT + cd $MAGE_ROOT - php bin/magento setup:install \ - --db-host="$DB_HOST" \ - --db-name="$DB_NAME" \ - --db-user="$DB_USER" \ - --admin-firstname="$ADMIN_FIRSTNAME" \ - --admin-lastname="$ADMIN_LASTNAME" \ - --admin-email="$ADMIN_EMAIL" \ - --admin-user="$ADMIN_USER" \ - --admin-password="$ADMIN_PASS" \ - --language="en_US" \ - --currency="USD" \ - --timezone="Europe/Moscow" + php bin/magento setup:install \ + --db-host="$DB_HOST" \ + --db-name="$DB_NAME" \ + --db-user="$DB_USER" \ + --admin-firstname="$ADMIN_FIRSTNAME" \ + --admin-lastname="$ADMIN_LASTNAME" \ + --admin-email="$ADMIN_EMAIL" \ + --admin-user="$ADMIN_USER" \ + --admin-password="$ADMIN_PASS" \ + --language="en_US" \ + --currency="USD" \ + --timezone="Europe/Moscow" } module_install() { - cd $MAGE_ROOT - mkdir -p app/code/Retailcrm/Retailcrm - cp -R $TRAVIS_BUILD_DIR/src/* app/code/Retailcrm/Retailcrm + cd $MAGE_ROOT + mkdir -p app/code/Retailcrm/Retailcrm + cp -R $TRAVIS_BUILD_DIR/src/* app/code/Retailcrm/Retailcrm - php bin/magento module:enable Retailcrm_Retailcrm - php bin/magento setup:upgrade - php bin/magento setup:di:compile + php bin/magento module:enable Retailcrm_Retailcrm + php bin/magento setup:upgrade + php bin/magento setup:di:compile } create_db diff --git a/src/Console/Command/CustomersExport.php b/src/Console/Command/CustomersExport.php index 1f5cc00..18a8aee 100644 --- a/src/Console/Command/CustomersExport.php +++ b/src/Console/Command/CustomersExport.php @@ -44,7 +44,7 @@ class CustomersExport extends Command protected function configure() { $this->setName('retailcrm:customers:export') - ->setDescription('Upload archive customers to retailCRM from Magento') + ->setDescription('Upload archive customers to RetailCRM from Magento') ->addArgument('from', InputArgument::OPTIONAL, 'Beginning order number') ->addArgument('to', InputArgument::OPTIONAL, 'End order number'); @@ -52,7 +52,7 @@ class CustomersExport extends Command } /** - * Upload customers to retailCRM + * Upload customers to RetailCRM * * @param InputInterface $input * @param OutputInterface $output diff --git a/src/Console/Command/OrdersExport.php b/src/Console/Command/OrdersExport.php index 838e5f9..92b984a 100644 --- a/src/Console/Command/OrdersExport.php +++ b/src/Console/Command/OrdersExport.php @@ -37,7 +37,7 @@ class OrdersExport extends Command protected function configure() { $this->setName('retailcrm:orders:export') - ->setDescription('Upload archive orders to retailCRM from Magento') + ->setDescription('Upload archive orders to RetailCRM from Magento') ->addArgument('from', InputArgument::OPTIONAL, 'Beginning order number') ->addArgument('to', InputArgument::OPTIONAL, 'End order number'); @@ -45,7 +45,7 @@ class OrdersExport extends Command } /** - * Upload orders to retailCRM + * Upload orders to RetailCRM * * @param InputInterface $input * @param OutputInterface $output diff --git a/src/Model/Config/Backend/ApiUrl.php b/src/Model/Config/Backend/ApiUrl.php index 6814613..ef2dfaf 100644 --- a/src/Model/Config/Backend/ApiUrl.php +++ b/src/Model/Config/Backend/ApiUrl.php @@ -82,7 +82,7 @@ class ApiUrl extends \Magento\Framework\App\Config\Value } elseif (!$response->isSuccessful() && $response['errorMsg'] == $api->getErrorText('errorApiKey')) { throw new \Magento\Framework\Exception\ValidatorException(__('Incorrect API key')); } elseif (isset($response['errorMsg']) && $response['errorMsg'] == $api->getErrorText('errorAccount')) { - throw new \Magento\Framework\Exception\ValidatorException(__('Incorrect URL of retailCRM')); + throw new \Magento\Framework\Exception\ValidatorException(__('Incorrect URL of RetailCRM')); } return true; diff --git a/src/Model/Config/Backend/ApiVersion.php b/src/Model/Config/Backend/ApiVersion.php index a55388f..fc04d13 100644 --- a/src/Model/Config/Backend/ApiVersion.php +++ b/src/Model/Config/Backend/ApiVersion.php @@ -82,7 +82,7 @@ class ApiVersion extends \Magento\Framework\App\Config\Value if ($response->isSuccessful()) { $availableVersions = $response['versions']; } else { - throw new \Magento\Framework\Exception\ValidatorException(__('Incorrect URL of retailCRM or API key')); + throw new \Magento\Framework\Exception\ValidatorException(__('Incorrect URL of RetailCRM or API key')); } if (isset($availableVersions)) { diff --git a/src/Model/Service/Customer.php b/src/Model/Service/Customer.php index 3c865c9..9a91d94 100644 --- a/src/Model/Service/Customer.php +++ b/src/Model/Service/Customer.php @@ -79,13 +79,17 @@ class Customer implements CustomerManagerInterface 'index' => $billing->getPostcode(), 'region' => $billing->getRegion(), 'city' => $billing->getCity(), - 'street' => $billing->getStreet(), + 'street' => is_array($billing->getStreet()) + ? implode(', ', $billing->getStreet()) + : $billing->getStreet(), 'text' => sprintf( '%s %s %s %s', $billing->getPostcode(), $billing->getRegion(), $billing->getCity(), - $billing->getStreet() + is_array($billing->getStreet()) + ? implode(', ', $billing->getStreet()) + : $billing->getStreet() ) ] ]; diff --git a/src/README.md b/src/README.md index 8280653..972fb7f 100644 --- a/src/README.md +++ b/src/README.md @@ -1 +1 @@ -Magento 2 module for interaction with retailCRM \ No newline at end of file +Magento 2 module for interaction with RetailCRM \ No newline at end of file diff --git a/src/Test/Helpers/FieldsetTest.php b/src/Test/Helpers/FieldsetTest.php index 3e32f75..c3a4ff9 100644 --- a/src/Test/Helpers/FieldsetTest.php +++ b/src/Test/Helpers/FieldsetTest.php @@ -20,6 +20,7 @@ class FieldsetTest extends TestCase protected $testElementId = 'test_element_id'; protected $testFieldSetCss = 'test_fieldset_css'; protected $objectFactory; + protected $secureRenderer; public function setUp() { @@ -88,6 +89,23 @@ class FieldsetTest extends TestCase $factoryCollection->expects($this->any())->method('create')->willReturn($elementCollection); $rendererMock = $this->createMock(\Magento\Framework\Data\Form\Element\Renderer\RendererInterface::class); + if (class_exists(\Magento\Framework\View\Helper\SecureHtmlRenderer::class)) { + + $this->secureRenderer = $this->createMock(\Magento\Framework\View\Helper\SecureHtmlRenderer::class); + $this->secureRenderer->method('renderEventListenerAsTag') + ->willReturnCallback( + function (string $event, string $js, string $selector): string { + return ""; + } + ); + $this->secureRenderer->method('renderStyleAsTag') + ->willReturnCallback( + function (string $style, string $selector): string { + return ""; + } + ); + } + $this->urlModelMock = $this->createMock(\Magento\Backend\Model\Url::class); $this->layoutMock = $this->createMock(\Magento\Framework\View\Layout::class); $this->groupMock = $this->createMock(\Magento\Config\Model\Config\Structure\Element\Group::class); @@ -100,7 +118,8 @@ class FieldsetTest extends TestCase $this->helperMock = $this->createMock(\Magento\Framework\View\Helper\Js::class); $this->form = $this->createPartialMock( \Magento\Config\Block\System\Config\Form::class, - ['getElements', 'getRequest'] + //['getElements', 'getRequest'] + ['getRequest'] ); //$this->form->expects($this->any())->method('getElements')->willReturn($elementCollection); $this->form->expects($this->any())->method('getRequest')->willReturn($this->requestMock); diff --git a/src/Test/Unit/Block/Adminhtml/System/Config/Form/Fieldset/PaymentTest.php b/src/Test/Unit/Block/Adminhtml/System/Config/Form/Fieldset/PaymentTest.php index 1d46690..417fbca 100644 --- a/src/Test/Unit/Block/Adminhtml/System/Config/Form/Fieldset/PaymentTest.php +++ b/src/Test/Unit/Block/Adminhtml/System/Config/Form/Fieldset/PaymentTest.php @@ -52,7 +52,8 @@ class PaymentTest extends \Retailcrm\Retailcrm\Test\Helpers\FieldsetTest 'client' => $client, 'paymentConfig' => $paymentConfig, 'context' => $this->context, - 'objectFactory' => $this->objectFactory + 'objectFactory' => $this->objectFactory, + 'secureRenderer' => $this->secureRenderer ]; $payment = $this->objectManager->getObject( diff --git a/src/Test/Unit/Block/Adminhtml/System/Config/Form/Fieldset/ShippingTest.php b/src/Test/Unit/Block/Adminhtml/System/Config/Form/Fieldset/ShippingTest.php index 63c9f96..f5b8e7a 100644 --- a/src/Test/Unit/Block/Adminhtml/System/Config/Form/Fieldset/ShippingTest.php +++ b/src/Test/Unit/Block/Adminhtml/System/Config/Form/Fieldset/ShippingTest.php @@ -52,7 +52,8 @@ class ShippingTest extends \Retailcrm\Retailcrm\Test\Helpers\FieldsetTest 'client' => $client, 'shippingConfig' => $shippingConfig, 'context' => $this->context, - 'objectFactory' => $this->objectFactory + 'objectFactory' => $this->objectFactory, + 'secureRenderer' => $this->secureRenderer ]; $shipping = $this->objectManager->getObject( diff --git a/src/Test/Unit/Block/Adminhtml/System/Config/Form/Fieldset/SiteTest.php b/src/Test/Unit/Block/Adminhtml/System/Config/Form/Fieldset/SiteTest.php index 930781d..781b07d 100644 --- a/src/Test/Unit/Block/Adminhtml/System/Config/Form/Fieldset/SiteTest.php +++ b/src/Test/Unit/Block/Adminhtml/System/Config/Form/Fieldset/SiteTest.php @@ -43,7 +43,8 @@ class SiteTest extends \Retailcrm\Retailcrm\Test\Helpers\FieldsetTest 'data' => ['group' => $this->groupMock], 'client' => $client, 'context' => $this->context, - 'objectFactory' => $this->objectFactory + 'objectFactory' => $this->objectFactory, + 'secureRenderer' => $this->secureRenderer ]; $site = $this->objectManager->getObject( diff --git a/src/Test/Unit/Block/Adminhtml/System/Config/Form/Fieldset/SitesTest.php b/src/Test/Unit/Block/Adminhtml/System/Config/Form/Fieldset/SitesTest.php index 8ce18ae..1c28209 100644 --- a/src/Test/Unit/Block/Adminhtml/System/Config/Form/Fieldset/SitesTest.php +++ b/src/Test/Unit/Block/Adminhtml/System/Config/Form/Fieldset/SitesTest.php @@ -55,7 +55,8 @@ class SitesTest extends \Retailcrm\Retailcrm\Test\Helpers\FieldsetTest 'client' => $client, 'storeManager' => $storeManager, 'context' => $this->context, - 'objectFactory' => $this->objectFactory + 'objectFactory' => $this->objectFactory, + 'secureRenderer' => $this->secureRenderer ]; $sites = $this->objectManager->getObject( diff --git a/src/Test/Unit/Block/Adminhtml/System/Config/Form/Fieldset/StatusTest.php b/src/Test/Unit/Block/Adminhtml/System/Config/Form/Fieldset/StatusTest.php index e993c76..217df4f 100644 --- a/src/Test/Unit/Block/Adminhtml/System/Config/Form/Fieldset/StatusTest.php +++ b/src/Test/Unit/Block/Adminhtml/System/Config/Form/Fieldset/StatusTest.php @@ -52,7 +52,8 @@ class StatusTest extends \Retailcrm\Retailcrm\Test\Helpers\FieldsetTest 'client' => $client, 'statusCollection' => $statusCollection, 'context' => $this->context, - 'objectFactory' => $this->objectFactory + 'objectFactory' => $this->objectFactory, + 'secureRenderer' => $this->secureRenderer ]; $status = $this->objectManager->getObject( diff --git a/src/composer.json b/src/composer.json index f6e90ec..4556c48 100644 --- a/src/composer.json +++ b/src/composer.json @@ -1,6 +1,6 @@ { "name": "retailcrm/retailcrm", - "description": "Retailcrm", + "description": "RetailCRM", "require": { "retailcrm/api-client-php": "~5.0" }, diff --git a/src/etc/adminhtml/system.xml b/src/etc/adminhtml/system.xml index 56617e1..b0d0556 100644 --- a/src/etc/adminhtml/system.xml +++ b/src/etc/adminhtml/system.xml @@ -2,7 +2,7 @@ - +
separator-top @@ -18,7 +18,7 @@ - You can create an API key in the administration section of retailCRM + You can create an API key in the administration section of RetailCRM diff --git a/src/i18n/es_ES.csv b/src/i18n/es_ES.csv index edd009c..c5989e4 100644 --- a/src/i18n/es_ES.csv +++ b/src/i18n/es_ES.csv @@ -1,7 +1,7 @@ "Settings","La configuración" "Main settings","La configuración general" "API key","La llave API" -"You can create an API key in the administration section of retailCRM","Puede crear la llave API en la sección administrativa del retailCRM" +"You can create an API key in the administration section of RetailCRM","Puede crear la llave API en la sección administrativa del RetailCRM" "API version","La versión API" "Catalogue settings","La configuración del catálogo" "Attributes for uploading to ICML","Los atributos para importar al ICML" @@ -15,10 +15,10 @@ "Setting the store by default","La configuración de la tienda por defecto" "Setting the stores correspondence","La configuración de la concordancia de tienda" "Enter API of your URL and API key","Introduce el enlace API y la llave API" -"Incorrect URL of retailCRM","La dirección del retailCRM es incorrecto" +"Incorrect URL of RetailCRM","La dirección del RetailCRM es incorrecto" "Make sure that the entered data is correct","Asegúrese de que los datos introducidos son correctos" "Incorrect API key","La llave API es incorrecta" -"Incorrect URL of retailCRM or API key","La dirección del retailCRM o la llave API son incorrectos" +"Incorrect URL of RetailCRM or API key","La dirección del RetailCRM o la llave API son incorrectos" "The selected API version is unavailable","La versión de la API seleccionada no está disponible" "Send","Enviar" "Default site","Tienda por defecto" diff --git a/src/i18n/ru_RU.csv b/src/i18n/ru_RU.csv index 43d50aa..436c336 100644 --- a/src/i18n/ru_RU.csv +++ b/src/i18n/ru_RU.csv @@ -1,7 +1,7 @@ "Settings","Настройки" "Main settings","Главные настройки" "API key","API ключ" -"You can create an API key in the administration section of retailCRM","Вы можете создать API ключ в административном разделе retailCRM" +"You can create an API key in the administration section of RetailCRM","Вы можете создать API ключ в административном разделе RetailCRM" "API version","Версия API" "Catalogue settings","Настройки каталога" "Attributes for uploading to ICML","Атрибуты для выгрузки в ICML" @@ -15,10 +15,10 @@ "Setting the store by default","Настройка магазина по умолчанию" "Setting the stores correspondence","Настройка соответствия магазинов" "Enter API of your URL and API key","Введите Ваш API URL и API ключ" -"Incorrect URL of retailCRM","Некорректный адрес retailCRM" +"Incorrect URL of RetailCRM","Некорректный адрес RetailCRM" "Make sure that the entered data is correct","Убедитесь, что введенные данные верны" "Incorrect API key","Некорректный API ключ" -"Incorrect URL of retailCRM or API key","Некорректный адрес retailCRM или API ключ" +"Incorrect URL of RetailCRM or API key","Некорректный адрес RetailCRM или API ключ" "The selected API version is unavailable","Выбранная версия API недоступна" "Send","Выгрузить" "Default site","Сайт по умолчанию"