Добавлена поддержка PHP 8.0 (#279)
This commit is contained in:
parent
6cd01dd572
commit
2e6b105d8d
@ -1,19 +1,12 @@
|
||||
FROM php:7.3-apache
|
||||
FROM php:8.0-apache
|
||||
|
||||
RUN a2enmod rewrite
|
||||
|
||||
RUN set -xe \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends git wget unzip imagemagick libpng-dev libjpeg-dev \
|
||||
libfreetype6-dev default-mysql-client libmcrypt-dev libicu-dev libxml2 libxml2-dev libmagickwand-dev \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr --with-freetype-dir=/usr \
|
||||
&& docker-php-ext-install opcache soap gd mbstring mysqli zip intl \
|
||||
&& pecl install mcrypt-1.0.1 imagick-3.4.4 \
|
||||
&& docker-php-ext-enable mcrypt imagick \
|
||||
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
|
||||
&& apt-get install -y unzip libpng-dev libzip-dev libonig-dev libjpeg-dev libmcrypt-dev wget \
|
||||
&& docker-php-ext-install mysqli zip
|
||||
|
||||
RUN curl --insecure https://getcomposer.org/composer.phar -o /usr/bin/composer && chmod +x /usr/bin/composer
|
||||
RUN wget -O /usr/bin/phpunit https://phar.phpunit.de/phpunit-7.phar && chmod +x /usr/bin/phpunit
|
||||
|
||||
WORKDIR /bitrix-module
|
||||
|
@ -7,7 +7,6 @@ log_errors = On
|
||||
display_startup_errors = On
|
||||
cgi.fix_pathinfo = 0
|
||||
date.timezone = "Europe/Moscow"
|
||||
mbstring.internal_encoding = "UTF-8"
|
||||
default_charset = utf-8
|
||||
max_input_vars = 10000
|
||||
post_max_size = 1024M
|
||||
|
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -20,7 +20,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
php-version: ['7.3']
|
||||
php-version: ['7.4', '8.0']
|
||||
bitrix-edition: ['small_business_encode', 'business_encode']
|
||||
services:
|
||||
mysql:
|
||||
|
@ -1,3 +1,6 @@
|
||||
## 2023-03-10 v.6.2.0
|
||||
- Добавлена поддержка PHP 8.0
|
||||
|
||||
## 2023-02-16 v.6.1.16
|
||||
- Добавление передачи магазина для корпоративных клиентов
|
||||
|
||||
|
@ -18,6 +18,8 @@ if (!file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/install/wizar
|
||||
|
||||
ob_start();
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/install/wizard/wizard.php';
|
||||
ob_clean();
|
||||
|
||||
require_once __DIR__ . '/../helpers/installation/ExtendedCreateModulesStep.php';
|
||||
require_once __DIR__ . '/../helpers/installation/Installer.php';
|
||||
|
||||
@ -25,8 +27,6 @@ $installer = new Installer();
|
||||
|
||||
$step = $argv[1];
|
||||
|
||||
ob_clean();
|
||||
|
||||
switch ($step) {
|
||||
case 'db_type':
|
||||
$installer->dbTypeStep();
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "retailcrm/bitrix-module",
|
||||
"scripts": {
|
||||
"pre-module-install": "cp -R intaro.retailcrm $BITRIX_PATH/bitrix/modules",
|
||||
"tests": "php vendor/bin/phpunit -c phpunit.xml.dist --whitelist=$BITRIX_PATH/bitrix/modules/intaro.retailcrm"
|
||||
"tests": "vendor/bin/phpunit -c phpunit.xml.dist --whitelist=$BITRIX_PATH/bitrix/modules/intaro.retailcrm"
|
||||
},
|
||||
"description": "Integration module for Bitrix & RetailCRM",
|
||||
"license": "MIT",
|
||||
@ -20,9 +20,9 @@
|
||||
"ext-xmlwriter": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^7",
|
||||
"phpunit/phpunit": "^8.5",
|
||||
"vlucas/phpdotenv": "^3.3",
|
||||
"mockery/mockery" : "^1.0",
|
||||
"fzaninotto/faker" : "^1.7"
|
||||
"fakerphp/faker": "^1.21"
|
||||
}
|
||||
}
|
||||
|
892
composer.lock
generated
892
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -138,7 +138,7 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa
|
||||
|
||||
if (isset($this->dataCrm['phones'])) {
|
||||
foreach ($this->dataCrm['phones'] as $phone) {
|
||||
if (isset($phone['old_number']) && in_array($phone['old_number'], $this->user)) {
|
||||
if (is_array($this->user) && isset($phone['old_number']) && in_array($phone['old_number'], $this->user)) {
|
||||
$key = array_search($phone['old_number'], $this->user);
|
||||
|
||||
if (isset($phone['number'])) {
|
||||
|
@ -99,7 +99,7 @@ class RestNormalizer
|
||||
$formatted[ $code ] = $this->formatting($value, true);
|
||||
}
|
||||
|
||||
if ($formatted[ $code ] === null || $formatted[ $code ] === '' || count($formatted[ $code ]) < 1) {
|
||||
if (empty($formatted[$code])) {
|
||||
if ($this->clear === true) {
|
||||
unset($formatted[ $code ]);
|
||||
}
|
||||
|
@ -18,8 +18,9 @@ class RetailCrmCollector
|
||||
{
|
||||
$keys = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_COLL_KEY, 0));
|
||||
$collector = COption::GetOptionString(self::$MODULE_ID, self::$CRM_COLL, 0);
|
||||
$request = \Bitrix\Main\Context::getCurrent()->getRequest();
|
||||
|
||||
if ($collector === 'Y' && !empty($keys[SITE_ID]) && ADMIN_SECTION !== true) {
|
||||
if ($collector === 'Y' && !empty($keys[SITE_ID]) && $request->isAdminSection() !== true) {
|
||||
global $USER;
|
||||
|
||||
$params = array();
|
||||
|
@ -12,7 +12,9 @@ class RetailCrmOnlineConsultant
|
||||
*/
|
||||
public static function add()
|
||||
{
|
||||
if (RetailcrmConfigProvider::isOnlineConsultantEnabled() && ADMIN_SECTION !== true) {
|
||||
$request = \Bitrix\Main\Context::getCurrent()->getRequest();
|
||||
|
||||
if (RetailcrmConfigProvider::isOnlineConsultantEnabled() && $request->isAdminSection() !== true) {
|
||||
\Bitrix\Main\Page\Asset::getInstance()->addString(
|
||||
RetailcrmConfigProvider::getOnlineConsultantScript(),
|
||||
true
|
||||
|
@ -40,7 +40,7 @@ class RetailCrmEvent
|
||||
* @return bool
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function OnAfterUserUpdate($arFields)
|
||||
public static function OnAfterUserUpdate($arFields)
|
||||
{
|
||||
if (isset($GLOBALS['RETAIL_CRM_HISTORY']) && $GLOBALS['RETAIL_CRM_HISTORY']) {
|
||||
return false;
|
||||
@ -67,7 +67,7 @@ class RetailCrmEvent
|
||||
* @param mixed $ID - Order id
|
||||
* @param mixed $arFields - Order arFields
|
||||
*/
|
||||
public function onUpdateOrder($ID, $arFields)
|
||||
public static function onUpdateOrder($ID, $arFields)
|
||||
{
|
||||
if (isset($GLOBALS['RETAIL_CRM_HISTORY']) && $GLOBALS['RETAIL_CRM_HISTORY']) {
|
||||
$GLOBALS['RETAILCRM_ORDER_OLD_EVENT'] = false;
|
||||
@ -91,7 +91,7 @@ class RetailCrmEvent
|
||||
*
|
||||
* @param object $event - Order object
|
||||
*/
|
||||
public function orderDelete($event)
|
||||
public static function orderDelete($event)
|
||||
{
|
||||
$GLOBALS['RETAILCRM_ORDER_DELETE'] = true;
|
||||
|
||||
@ -426,7 +426,7 @@ class RetailCrmEvent
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
*/
|
||||
public function paymentSave(Payment $event)
|
||||
public static function paymentSave(Payment $event)
|
||||
{
|
||||
$apiVersion = COption::GetOptionString(self::$MODULE_ID, 'api_version', 0);
|
||||
|
||||
@ -472,7 +472,9 @@ class RetailCrmEvent
|
||||
$payments = $orderCrm['order']['payments'];
|
||||
}
|
||||
|
||||
if ($payments) {
|
||||
$paymentsExternalIds = [];
|
||||
|
||||
if (!empty($payments)) {
|
||||
foreach ($payments as $payment) {
|
||||
if (isset($payment['externalId'])) {
|
||||
if (RCrmActions::isNewExternalId($payment['externalId'])) {
|
||||
@ -524,9 +526,9 @@ class RetailCrmEvent
|
||||
|
||||
$arPaymentExtId = RCrmActions::generatePaymentExternalId($arPayment['ID']);
|
||||
|
||||
if (array_key_exists($arPaymentExtId, $paymentsExternalIds)) {
|
||||
if (!empty($paymentsExternalIds) && array_key_exists($arPaymentExtId, $paymentsExternalIds)) {
|
||||
$paymentData = $paymentsExternalIds[$arPaymentExtId];
|
||||
} elseif (array_key_exists($arPayment['ID'], $paymentsExternalIds)) {
|
||||
} elseif (!empty($paymentsExternalIds) && array_key_exists($arPayment['ID'], $paymentsExternalIds)) {
|
||||
$paymentData = $paymentsExternalIds[$arPayment['ID']];
|
||||
} else {
|
||||
$paymentData = [];
|
||||
@ -564,7 +566,7 @@ class RetailCrmEvent
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function paymentDelete(Payment $event): void
|
||||
public static function paymentDelete(Payment $event): void
|
||||
{
|
||||
$apiVersion = COption::GetOptionString(self::$MODULE_ID, 'api_version', 0);
|
||||
|
||||
|
@ -72,7 +72,7 @@ class RetailCrmHistory
|
||||
|
||||
Logger::getInstance()->write($customerH, 'customerHistory');
|
||||
|
||||
if (count($customerH) == 0) {
|
||||
if (is_array($customerH) && count($customerH) === 0) {
|
||||
if ($customerHistory['history']['totalPageCount'] > $customerHistory['history']['currentPage']) {
|
||||
$historyFilter['page'] = $customerHistory['history']['currentPage'] + 1;
|
||||
|
||||
@ -271,7 +271,7 @@ class RetailCrmHistory
|
||||
|
||||
Logger::getInstance()->write($orderH, 'orderHistory');
|
||||
|
||||
if (count($orderH) === 0) {
|
||||
if (is_array($orderH) && count($orderH) === 0) {
|
||||
if ($orderHistory['history']['totalPageCount'] > $orderHistory['history']['currentPage']) {
|
||||
$historyFilter['page'] = $orderHistory['history']['currentPage'] + 1;
|
||||
|
||||
@ -722,7 +722,7 @@ class RetailCrmHistory
|
||||
} else {
|
||||
self::setProp($somePropValue, RCrmActions::fromJSON($order[$key]));
|
||||
}
|
||||
} elseif (array_key_exists($key, $order['delivery']['address'])) {
|
||||
} elseif (is_array($order['delivery']['address']) && array_key_exists($key, $order['delivery']['address'])) {
|
||||
if ($propsKey[$orderProp]['TYPE'] == 'LOCATION') {
|
||||
|
||||
if (!empty($order['delivery']['address'][$key])) {
|
||||
@ -793,7 +793,7 @@ class RetailCrmHistory
|
||||
->getItemByOrderPropertyId($propsKey[$orderProp]['ID']);
|
||||
|
||||
self::setProp($somePropValue, RCrmActions::fromJSON($order[$key]));
|
||||
} elseif(array_key_exists($key, $order['contragent'])) {
|
||||
} elseif(is_array($order['contragent']) && array_key_exists($key, $order['contragent'])) {
|
||||
$somePropValue = $propertyCollection
|
||||
->getItemByOrderPropertyId($propsKey[$orderProp]['ID']);
|
||||
self::setProp($somePropValue, RCrmActions::fromJSON($order['contragent'][$key]));
|
||||
@ -1115,7 +1115,7 @@ class RetailCrmHistory
|
||||
$orderSumm += $item->getFinalPrice();
|
||||
}
|
||||
|
||||
if (array_key_exists('cost', $order['delivery'])) {
|
||||
if (is_array($order['delivery']) && array_key_exists('cost', $order['delivery'])) {
|
||||
$deliverySumm = $order['delivery']['cost'];
|
||||
} else {
|
||||
$deliverySumm = $newOrder->getDeliveryPrice();
|
||||
@ -1228,8 +1228,9 @@ class RetailCrmHistory
|
||||
|
||||
if (!empty($newHistoryPayments)) {
|
||||
foreach ($newOrder->getPaymentCollection() as $orderPayment) {
|
||||
if (array_key_exists($orderPayment->getField('XML_ID'), $newHistoryPayments)) {
|
||||
|
||||
if (is_array($newHistoryPayments)
|
||||
&& array_key_exists($orderPayment->getField('XML_ID'), $newHistoryPayments)
|
||||
) {
|
||||
$paymentId = $orderPayment->getId();
|
||||
$paymentExternalId = RCrmActions::generatePaymentExternalId($paymentId);
|
||||
if (is_null($paymentId)) {
|
||||
@ -1372,7 +1373,10 @@ class RetailCrmHistory
|
||||
}
|
||||
|
||||
if ($fields['customer'][$change['field']] == 'phones') {
|
||||
$key = count($customers[$change['customer']['id']]['phones']);
|
||||
if (is_array($customers[$change['customer']['id']]['phones'])) {
|
||||
$key = count($customers[$change['customer']['id']]['phones']);
|
||||
}
|
||||
|
||||
if (isset($change['oldValue'])) {
|
||||
$customers[$change['customer']['id']]['phones'][$key]['old_number'] = $change['oldValue'];
|
||||
}
|
||||
@ -1463,7 +1467,7 @@ class RetailCrmHistory
|
||||
$change['order']['payments'] = $payments;
|
||||
}
|
||||
|
||||
if (isset($change['order']['contragent']) && count($change['order']['contragent']) > 0) {
|
||||
if (is_array($change['order']['contragent']) && isset($change['order']['contragent']) && count($change['order']['contragent']) > 0) {
|
||||
foreach ($change['order']['contragent'] as $name => $value) {
|
||||
$change['order'][$name] = self::newValue($value);
|
||||
}
|
||||
@ -1875,7 +1879,7 @@ class RetailCrmHistory
|
||||
|
||||
public static function newValue($value)
|
||||
{
|
||||
if (array_key_exists('code', $value)) {
|
||||
if (is_array($value) && array_key_exists('code', $value)) {
|
||||
return $value['code'];
|
||||
} else {
|
||||
return $value;
|
||||
|
@ -59,7 +59,6 @@ class RetailCrmOrder
|
||||
|
||||
$dimensionsSetting = RetailcrmConfigProvider::getOrderDimensions();
|
||||
$currency = RetailcrmConfigProvider::getCurrencyOrDefault();
|
||||
$optionCorpClient = RetailcrmConfigProvider::getCorporateClientStatus();
|
||||
|
||||
$order = [
|
||||
'number' => $arOrder['NUMBER'],
|
||||
@ -105,6 +104,7 @@ class RetailCrmOrder
|
||||
//fields
|
||||
foreach ($arOrder['PROPS']['properties'] as $prop) {
|
||||
if (!empty($arParams['optionsLegalDetails'])
|
||||
&& is_array($arParams['optionsLegalDetails'][$arOrder['PERSON_TYPE_ID']])
|
||||
&& $search = array_search($prop['CODE'], $arParams['optionsLegalDetails'][$arOrder['PERSON_TYPE_ID']])
|
||||
) {
|
||||
$order['contragent'][$search] = $prop['VALUE'][0];//legal order data
|
||||
@ -112,7 +112,8 @@ class RetailCrmOrder
|
||||
&& $search = array_search($prop['CODE'], $arParams['optionsCustomFields'][$arOrder['PERSON_TYPE_ID']])
|
||||
) {
|
||||
$order['customFields'][$search] = $prop['VALUE'][0];//custom properties
|
||||
} elseif ($search = array_search($prop['CODE'], $arParams['optionsOrderProps'][$arOrder['PERSON_TYPE_ID']])) {//other
|
||||
} elseif (is_array($arParams['optionsOrderProps'][$arOrder['PERSON_TYPE_ID']])
|
||||
&& $search = array_search($prop['CODE'], $arParams['optionsOrderProps'][$arOrder['PERSON_TYPE_ID']])) {//other
|
||||
if (in_array($search, ['fio', 'phone', 'email'])) {//fio, phone, email
|
||||
if ($search === 'fio') {
|
||||
$order = array_merge($order, RCrmActions::explodeFio($prop['VALUE'][0]));//add fio fields
|
||||
@ -188,6 +189,7 @@ class RetailCrmOrder
|
||||
}
|
||||
|
||||
//basket
|
||||
|
||||
foreach ($arOrder['BASKET'] as $position => $product) {
|
||||
$itemId = null;
|
||||
$externalId = $position . '_' . $product['PRODUCT_ID'];
|
||||
@ -196,9 +198,15 @@ class RetailCrmOrder
|
||||
$externalIds = $orderItems[$externalId]['externalIds'];
|
||||
$itemId = $orderItems[$externalId]['id'];
|
||||
|
||||
$key = array_search('bitrix', array_column($externalIds, 'code'));
|
||||
$key = null;
|
||||
$keyBasketId = null;
|
||||
|
||||
if ($externalIds[$key]['code'] === 'bitrix') {
|
||||
if (is_array($externalIds)) {
|
||||
$key = array_search('bitrix', array_column($externalIds, 'code'));
|
||||
$keyBasketId = array_search('bitrixBasketId', array_column($externalIds, 'code'));
|
||||
}
|
||||
|
||||
if (isset($externalIds[$key]['code']) && $externalIds[$key]['code'] === 'bitrix') {
|
||||
$externalIds[$key] = [
|
||||
'code' => 'bitrix',
|
||||
'value' => $externalId,
|
||||
@ -208,11 +216,11 @@ class RetailCrmOrder
|
||||
'code' => 'bitrix',
|
||||
'value' => $externalId,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$keyBasketId = array_search('bitrixBasketId', array_column($externalIds, 'code'));
|
||||
|
||||
if ($externalIds[$keyBasketId]['code'] === 'bitrixBasketId') {
|
||||
if (isset($externalIds[$keyBasketId]['code'])
|
||||
&& $externalIds[$keyBasketId]['code'] === 'bitrixBasketId'
|
||||
) {
|
||||
$externalIds[$keyBasketId] = [
|
||||
'code' => 'bitrixBasketId',
|
||||
'value' => $product['ID'],
|
||||
@ -222,7 +230,7 @@ class RetailCrmOrder
|
||||
'code' => 'bitrixBasketId',
|
||||
'value' => $product['ID'],
|
||||
];
|
||||
}
|
||||
}
|
||||
} else { //create
|
||||
$externalIds = [
|
||||
[
|
||||
|
@ -9,8 +9,9 @@ class RetailCrmUa
|
||||
{
|
||||
$ua = COption::GetOptionString(self::$MODULE_ID, self::$CRM_UA, 0);
|
||||
$uaKeys = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_UA_KEYS, 0));
|
||||
$request = \Bitrix\Main\Context::getCurrent()->getRequest();
|
||||
|
||||
if ($ua === 'Y' && !empty($uaKeys[SITE_ID]['ID']) && !empty($uaKeys[SITE_ID]['INDEX']) && ADMIN_SECTION !== true) {
|
||||
if ($ua === 'Y' && !empty($uaKeys[SITE_ID]['ID']) && !empty($uaKeys[SITE_ID]['INDEX']) && $request->isAdminSection() !== true) {
|
||||
global $APPLICATION;
|
||||
|
||||
$ua = "
|
||||
|
@ -1 +1 @@
|
||||
- Добавлена поддержка работы с корпоративными клиентами при мультисайтовости cms системы
|
||||
- Добавлена поддержка PHP 8.0
|
||||
|
@ -495,7 +495,7 @@ if ($STEP === 1) {
|
||||
<?php
|
||||
if ($isSetupModulePage) { ?>
|
||||
<span class="text"><?=GetMessage('AGENT_LOADING')?> </span>
|
||||
<input type="checkbox" name="NEED_CATALOG_AGENT" value="agent" onclick="checkProfile(this);"><Br>
|
||||
<input type="checkbox" name="NEED_CATALOG_AGENT" value="agent" onclick="checkProfile(this);"><br>
|
||||
<br>
|
||||
<br>
|
||||
<span class="text"><?=GetMessage('LOAD_NOW')?> </span>
|
||||
|
@ -61,9 +61,7 @@ if (empty(ConfigProvider::getSitesAvailable())) {
|
||||
try {
|
||||
$credentials = $client->getCredentials();
|
||||
|
||||
ConfigProvider::setSitesAvailable(
|
||||
count($credentials->sitesAvailable) > 0 ? $credentials->sitesAvailable[0] : ''
|
||||
);
|
||||
ConfigProvider::setSitesAvailable($credentials->sitesAvailable[0] ?? '');
|
||||
} catch (ArgumentOutOfRangeException | CurlException $exception) {
|
||||
Logger::getInstance()->write($exception->getMessage());
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ class intaro_retailcrm extends CModule
|
||||
public $PROTOCOL = 'protocol';
|
||||
public $INSTALL_PATH;
|
||||
|
||||
function intaro_retailcrm()
|
||||
public function __construct()
|
||||
{
|
||||
$arModuleVersion = [];
|
||||
$path = str_replace("\\", '/', __FILE__);
|
||||
@ -615,15 +615,69 @@ class intaro_retailcrm extends CModule
|
||||
COption::SetOptionString($this->MODULE_ID, $this->PROTOCOL, 'http://');
|
||||
}
|
||||
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_TYPES_ARR, serialize(RCrmActions::clearArr($orderTypesArr)));
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_DELIVERY_TYPES_ARR, serialize(RCrmActions::clearArr($deliveryTypesArr)));
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT_TYPES, serialize(RCrmActions::clearArr($paymentTypesArr)));
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT_STATUSES, serialize(RCrmActions::clearArr($paymentStatusesArr)));
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_PAYMENT, serialize(RCrmActions::clearArr($paymentArr)));
|
||||
// Set order types
|
||||
if (!empty($orderTypesArr)) {
|
||||
COption::SetOptionString(
|
||||
$this->MODULE_ID,
|
||||
$this->CRM_ORDER_TYPES_ARR,
|
||||
serialize(RCrmActions::clearArr($orderTypesArr)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Set delivery types
|
||||
if (!empty($deliveryTypesArr)) {
|
||||
COption::SetOptionString(
|
||||
$this->MODULE_ID,
|
||||
$this->CRM_DELIVERY_TYPES_ARR,
|
||||
serialize(RCrmActions::clearArr($deliveryTypesArr)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Set payment types
|
||||
if (!empty($paymentTypesArr)) {
|
||||
COption::SetOptionString(
|
||||
$this->MODULE_ID,
|
||||
$this->CRM_PAYMENT_TYPES,
|
||||
serialize(RCrmActions::clearArr($paymentTypesArr)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Set payment statuses
|
||||
if (!empty($paymentStatusesArr)) {
|
||||
COption::SetOptionString(
|
||||
$this->MODULE_ID,
|
||||
$this->CRM_PAYMENT_STATUSES,
|
||||
serialize(RCrmActions::clearArr($paymentStatusesArr)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Set payments
|
||||
if (!empty($paymentArr)) {
|
||||
COption::SetOptionString(
|
||||
$this->MODULE_ID,
|
||||
$this->CRM_PAYMENT,
|
||||
serialize(RCrmActions::clearArr($paymentArr)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_LAST_ID, 0);
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_DISCHARGE, 1);
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_ORDER_FAILED_IDS, serialize([]));
|
||||
COption::SetOptionString($this->MODULE_ID, $this->CRM_CANSEL_ORDER, serialize(RCrmActions::clearArr($canselOrderArr)));
|
||||
|
||||
// Set cansel order
|
||||
if (!empty($canselOrderArr)) {
|
||||
COption::SetOptionString(
|
||||
$this->MODULE_ID,
|
||||
$this->CRM_CANSEL_ORDER,
|
||||
serialize(RCrmActions::clearArr($canselOrderArr)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ($orderProps = COption::GetOptionString($this->OLD_MODULE_ID, $this->CRM_ORDER_PROPS, 0)) {
|
||||
$arResult['ORDER_PROPS'] = unserialize($orderProps);
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$arModuleVersion = [
|
||||
'VERSION' => '6.1.16',
|
||||
'VERSION_DATE' => '2023-02-16 12:00:00'
|
||||
'VERSION' => '6.2.0',
|
||||
'VERSION_DATE' => '2023-03-10 12:00:00'
|
||||
];
|
||||
|
@ -236,7 +236,7 @@ class CustomerBuilder implements BuilderInterface
|
||||
|
||||
private function handleFields(): void
|
||||
{
|
||||
if (count($this->customFields) === 0) {
|
||||
if (is_array($this->customFields) && count($this->customFields) === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ class EventsHandlers
|
||||
* @param array $arParams
|
||||
* @param array $arResult
|
||||
*/
|
||||
public function OnSaleComponentOrderResultPreparedHandler(
|
||||
public static function OnSaleComponentOrderResultPreparedHandler(
|
||||
Order $order,
|
||||
array $arUserResult,
|
||||
HttpRequest $request,
|
||||
@ -125,7 +125,7 @@ class EventsHandlers
|
||||
*
|
||||
* @param \Bitrix\Main\Event $event
|
||||
*/
|
||||
public function OnSaleOrderSavedHandler(Event $event): void
|
||||
public static function OnSaleOrderSavedHandler(Event $event): void
|
||||
{
|
||||
if (self::$disableSaleHandler === true) {
|
||||
return;
|
||||
@ -222,7 +222,7 @@ class EventsHandlers
|
||||
* @return mixed
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function OnAfterUserRegisterHandler(array $arFields): void
|
||||
public static function OnAfterUserRegisterHandler(array $arFields): void
|
||||
{
|
||||
if (isset($arFields['USER_ID']) && $arFields['USER_ID'] > 0) {
|
||||
$user = UserRepository::getById($arFields['USER_ID']);
|
||||
|
@ -37,6 +37,10 @@ class TypedArrayStrategy implements DeserializeStrategyInterface
|
||||
$valueType = '';
|
||||
$result = [];
|
||||
|
||||
if (!is_array($value)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
if (strpos($this->innerType, ',') !== false) {
|
||||
[$keyType, $valueType] = static::getInnerTypes($this->innerType);
|
||||
|
||||
|
@ -36,6 +36,10 @@ class TypedArrayStrategy implements SerializeStrategyInterface
|
||||
$valueType = '';
|
||||
$result = [];
|
||||
|
||||
if (!is_array($value)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
if (strpos($this->innerType, ',') !== false) {
|
||||
[$keyType, $valueType] = static::getInnerTypes($this->innerType);
|
||||
|
||||
|
@ -46,12 +46,12 @@ class Register extends Controller
|
||||
return [
|
||||
'saveUserLpFields' => [
|
||||
'-prefilters' => [
|
||||
new Authentication,
|
||||
Authentication::class,
|
||||
],
|
||||
],
|
||||
'resetUserLpFields' => [
|
||||
'-prefilters' => [
|
||||
new Authentication,
|
||||
Authentication::class,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
@ -624,7 +624,7 @@ class SettingsService
|
||||
*/
|
||||
public function isExport($iblockId, $iblockExport): bool
|
||||
{
|
||||
if (count($iblockExport) !== 0) {
|
||||
if (is_array($iblockExport) && count($iblockExport) !== 0) {
|
||||
return (in_array($iblockId, $iblockExport));
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ use Intaro\RetailCrm\Component\ConfigProvider;
|
||||
use Intaro\RetailCrm\Component\Factory\ClientFactory;
|
||||
use Intaro\RetailCrm\Component\Json\Serializer;
|
||||
use Intaro\RetailCrm\Component\ServiceLocator;
|
||||
use Intaro\RetailCrm\Model\Api\IdentifiersPair;
|
||||
use Intaro\RetailCrm\Model\Api\LoyaltyAccount;
|
||||
use Intaro\RetailCrm\Model\Api\LoyaltyAccountApiFilterType;
|
||||
use Intaro\RetailCrm\Model\Api\Request\Loyalty\Account\LoyaltyAccountRequest;
|
||||
@ -118,9 +119,12 @@ class LoyaltyAccountService
|
||||
$createRequest->loyaltyAccount = new SerializedCreateLoyaltyAccount();
|
||||
$createRequest->loyaltyAccount->phoneNumber = $phone ?? '';
|
||||
$createRequest->loyaltyAccount->cardNumber = $card ?? '';
|
||||
$createRequest->loyaltyAccount->customer->externalId = $externalId;
|
||||
$createRequest->loyaltyAccount->customFields = [];
|
||||
|
||||
$createRequest->loyaltyAccount->customer = new IdentifiersPair();
|
||||
$createRequest->loyaltyAccount->customer->externalId = $externalId;
|
||||
|
||||
|
||||
$createResponse = $client->createLoyaltyAccount($createRequest);
|
||||
|
||||
if ($createResponse instanceof LoyaltyAccountCreateResponse) {
|
||||
|
@ -22,6 +22,7 @@ use Intaro\RetailCrm\Component\Constants;
|
||||
use Intaro\RetailCrm\Component\Factory\ClientFactory;
|
||||
use Intaro\RetailCrm\Component\ServiceLocator;
|
||||
use Intaro\RetailCrm\Model\Api\LoyaltyAccount;
|
||||
use Intaro\RetailCrm\Model\Api\LoyaltyAccountApiFilterType;
|
||||
use Intaro\RetailCrm\Model\Api\OrderProduct;
|
||||
use Intaro\RetailCrm\Model\Api\PriceType;
|
||||
use Intaro\RetailCrm\Model\Api\Request\Loyalty\Account\LoyaltyAccountRequest;
|
||||
@ -176,6 +177,7 @@ class LoyaltyService
|
||||
public function getLoyaltyAccounts(int $idInLoyalty): ?LoyaltyAccount
|
||||
{
|
||||
$request = new LoyaltyAccountRequest();
|
||||
$request->filter = new LoyaltyAccountApiFilterType();
|
||||
$request->filter->id = $idInLoyalty;
|
||||
$request->filter->sites = $this->site;
|
||||
|
||||
|
@ -46,7 +46,7 @@ class Utils
|
||||
foreach ($arr as $index => $node) {
|
||||
$result[$index] = is_array($node) === true ? $this->clearArray($node) : trim($node);
|
||||
|
||||
if ($result[$index] === '' || $result[$index] === null || count($result[$index]) < 1) {
|
||||
if (empty($result[$index])) {
|
||||
unset($result[$index]);
|
||||
}
|
||||
}
|
||||
|
@ -99,14 +99,22 @@ class TokenParser
|
||||
*/
|
||||
public function parseUseStatement()
|
||||
{
|
||||
|
||||
$groupRoot = '';
|
||||
$class = '';
|
||||
$alias = '';
|
||||
$statements = [];
|
||||
$explicitAlias = false;
|
||||
while (($token = $this->next())) {
|
||||
if (false !== strpos(PHP_VERSION, '8') && $token[0] === T_NAME_QUALIFIED) {
|
||||
$fullAlias = explode('\\', $token[1]);
|
||||
$alias = $fullAlias[array_key_last($fullAlias)];
|
||||
$statements[strtolower($alias)] = $token[1];
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$isNameToken = $token[0] === T_STRING || $token[0] === T_NS_SEPARATOR;
|
||||
|
||||
if (!$explicitAlias && $isNameToken) {
|
||||
$class .= $token[1];
|
||||
$alias = $token[1];
|
||||
|
@ -525,11 +525,8 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
|
||||
}
|
||||
|
||||
$bitrixCorpShopsArr = array_values(array_filter($_POST, 'maskCorp', ARRAY_FILTER_USE_KEY));
|
||||
|
||||
RegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmCc", "add");
|
||||
} else {
|
||||
$cc = 'N';
|
||||
UnRegisterModuleDependences("main", "OnBeforeProlog", $mid, "RetailCrmCc", "add");
|
||||
}
|
||||
|
||||
//purchasePrice_null
|
||||
@ -983,6 +980,8 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
||||
<script type="text/javascript" src="/bitrix/js/main/jquery/jquery-1.7.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
function createTemplates(donor) {
|
||||
BX.ajax.runAction('intaro:retailcrm.api.adminpanel.createTemplate',
|
||||
@ -1282,6 +1281,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<form method="POST" action="<?php echo $uri; ?>" id="FORMACTION">
|
||||
<?php
|
||||
echo bitrix_sessid_post();
|
||||
@ -1436,7 +1436,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
|
||||
</td>
|
||||
<td width="30%">
|
||||
<label>
|
||||
<input name="order-cansel-<?php echo $bitrixPaymentStatus['ID']; ?>" <?php if (in_array($bitrixPaymentStatus['ID'], $canselOrderArr)) {
|
||||
<input name="order-cansel-<?php echo $bitrixPaymentStatus['ID']; ?>" <?php if (is_array($canselOrderArr) && in_array($bitrixPaymentStatus['ID'], $canselOrderArr)) {
|
||||
echo "checked";
|
||||
} ?> value="Y" type="checkbox"/>
|
||||
</label>
|
||||
@ -1602,7 +1602,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
|
||||
</tr>
|
||||
<? endforeach; ?>
|
||||
<? endif; ?>
|
||||
<tr class="heading legal-detail-title-<?php echo $bitrixOrderType['ID']; ?>" <?php if (count($optionsLegalDetails[$bitrixOrderType['ID']]) < 1) {
|
||||
<tr class="heading legal-detail-title-<?php echo $bitrixOrderType['ID']; ?>" <?php if (is_array($optionsLegalDetails[$bitrixOrderType['ID']]) && count($optionsLegalDetails[$bitrixOrderType['ID']]) < 1) {
|
||||
echo 'style="display:none"';
|
||||
} ?>>
|
||||
<td colspan="2" style="background-color: transparent;">
|
||||
@ -2115,7 +2115,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
|
||||
echo 'style="display: none;"';
|
||||
} ?>>
|
||||
<td colspan="2" class="option-other-center">
|
||||
<label><input class="addr" type="checkbox" name="shops-exoprt-<?= $sitesList['code']; ?>" value="<?= $sitesList['code']?>" <?php if (in_array($sitesList['code'], $optionShops)) {
|
||||
<label><input class="addr" type="checkbox" name="shops-exoprt-<?= $sitesList['code']; ?>" value="<?= $sitesList['code']?>" <?php if (is_array($optionShops) && in_array($sitesList['code'], $optionShops)) {
|
||||
echo "checked";
|
||||
} ?>> <?php echo $sitesList['name'] . ' (' . $sitesList['code'] . ')'; ?>
|
||||
</label>
|
||||
@ -2136,8 +2136,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
|
||||
echo 'style="display: none;"';
|
||||
} ?>>
|
||||
<td colspan="2" class="option-other-center">
|
||||
<label><input class="addr" type="checkbox" name="iblocks-stores-<? echo $catalogExportIblock['ID']; ?>" value="Y" <?php if (in_array($catalogExportIblock['ID'],
|
||||
$optionIblocksInventories)) {
|
||||
<label><input class="addr" type="checkbox" name="iblocks-stores-<? echo $catalogExportIblock['ID']; ?>" value="Y" <?php if (is_array($optionIblocksInventories) && in_array($catalogExportIblock['ID'], $optionIblocksInventories)) {
|
||||
echo "checked";
|
||||
} ?>> <?php echo '[' . $catalogExportIblock['CODE'] . '] ' . $catalogExportIblock['NAME'] . ' (' . $catalogExportIblock['LID'] . ')'; ?></label>
|
||||
</td>
|
||||
@ -2194,7 +2193,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
|
||||
echo 'style="display: none;"';
|
||||
} ?>>
|
||||
<td colspan="2" class="option-other-center">
|
||||
<label><input class="addr" type="checkbox" name="shops-price-<? echo $sitesList['code']; ?>" value="<? echo $sitesList['code']; ?>" <?php if (in_array($sitesList['code'], $optionPriceShops)) {
|
||||
<label><input class="addr" type="checkbox" name="shops-price-<? echo $sitesList['code']; ?>" value="<? echo $sitesList['code']; ?>" <?php if (is_array($optionPriceShops) && in_array($sitesList['code'], $optionPriceShops)) {
|
||||
echo "checked";
|
||||
} ?>> <?php echo $sitesList['name'] . ' (' . $sitesList['code'] . ')'; ?>
|
||||
</label>
|
||||
@ -2215,8 +2214,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
|
||||
echo 'style="display: none;"';
|
||||
} ?>>
|
||||
<td colspan="2" class="option-other-center">
|
||||
<label><input class="addr" type="checkbox" name="iblocks-prices-<? echo $catalogExportIblock['ID']; ?>" value="Y" <?php if (in_array($catalogExportIblock['ID'],
|
||||
$optionIblocksPrices)) {
|
||||
<label><input class="addr" type="checkbox" name="iblocks-prices-<? echo $catalogExportIblock['ID']; ?>" value="Y" <?php if (is_array($optionIblocksPrices) && in_array($catalogExportIblock['ID'], $optionIblocksPrices)) {
|
||||
echo "checked";
|
||||
} ?>> <?php echo '[' . $catalogExportIblock['CODE'] . '] ' . $catalogExportIblock['NAME'] . ' (' . $catalogExportIblock['LID'] . ')'; ?></label>
|
||||
</td>
|
||||
@ -2383,7 +2381,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
|
||||
<td width="50%" class="" name="<?php ?>" align="center">
|
||||
<?php foreach ($arResult['sitesList'] as $sitesList): ?>
|
||||
<td colspan="2" class="option-other-center">
|
||||
<label><input class="addr" type="checkbox" name="shops-corporate-<? echo $sitesList['code']; ?>" value="<? echo $sitesList['code']; ?>" <?php if (in_array($sitesList['code'], $optionCorpShops)) {
|
||||
<label><input class="addr" type="checkbox" name="shops-corporate-<? echo $sitesList['code']; ?>" value="<? echo $sitesList['code']; ?>" <?php if (is_array($optionCorpShops) && in_array($sitesList['code'], $optionCorpShops)) {
|
||||
echo "checked";
|
||||
} ?>> <?php echo $sitesList['name'] . ' (' . $sitesList['code'] . ')'; ?>
|
||||
</label>
|
||||
|
@ -19,7 +19,7 @@ class BitrixTestCase extends \PHPUnit\Framework\TestCase
|
||||
* этот метод phpUnit вызывает перед запуском текущего теста
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
// создание экземпляра Faker, который будет создавать рандомные данные
|
||||
$this->faker = \Faker\Factory::create();
|
||||
@ -29,7 +29,7 @@ class BitrixTestCase extends \PHPUnit\Framework\TestCase
|
||||
* этот метод phpUnit вызывает после исполнения текущего теста
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function tearDown()
|
||||
public function tearDown(): void
|
||||
{
|
||||
// без этого вызова Mockery не будет работать
|
||||
\Mockery::close();
|
||||
|
@ -12,7 +12,7 @@ class AddressBuilderTest extends \PHPUnit\Framework\TestCase
|
||||
/**@var array $dataCrm */
|
||||
protected $dataCrm;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ class CustomerBuilderTest extends \PHPUnit\Framework\TestCase
|
||||
/**@var array $dataCrm */
|
||||
protected $dataCrm;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ class RetailCrmCollectorTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
const TEST_KEY = 'RC-XXXXXXXXXX-X';
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -26,7 +26,7 @@ class RetailCrmCollectorTest extends \PHPUnit\Framework\TestCase
|
||||
RetailCrmCollector::add();
|
||||
$strings = \Bitrix\Main\Page\Asset::getInstance()->getStrings();
|
||||
|
||||
$this->assertContains(self::TEST_KEY, $strings);
|
||||
$this->assertContains('customerId', $strings);
|
||||
$this->assertStringContainsString(self::TEST_KEY, $strings);
|
||||
$this->assertStringContainsString('customerId', $strings);
|
||||
}
|
||||
}
|
||||
|
@ -5,12 +5,7 @@
|
||||
*/
|
||||
class RetailCrmEventTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @var RetailCrmEvent
|
||||
*/
|
||||
private $retailcrmEvent;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -44,7 +39,7 @@ class RetailCrmEventTest extends PHPUnit\Framework\TestCase
|
||||
$arFields['RESULT'] = [];
|
||||
}
|
||||
|
||||
$result = $this->retailcrmEvent->OnAfterUserUpdate($arFields);
|
||||
$result = RetailCrmEvent::OnAfterUserUpdate($arFields);
|
||||
|
||||
$this->assertEquals(false, $result);
|
||||
}
|
||||
@ -86,7 +81,7 @@ class RetailCrmEventTest extends PHPUnit\Framework\TestCase
|
||||
COption::SetOptionString('intaro.retailcrm', 'api_version', 'v4');
|
||||
}
|
||||
|
||||
$result = $this->retailcrmEvent->paymentSave($event);
|
||||
$result = RetailCrmEvent::paymentSave($event);
|
||||
|
||||
$this->assertEquals(false, $result);
|
||||
}
|
||||
@ -114,7 +109,7 @@ class RetailCrmEventTest extends PHPUnit\Framework\TestCase
|
||||
COption::SetOptionString('intaro.retailcrm', 'api_version', 'v4');
|
||||
}
|
||||
|
||||
$result = $this->retailcrmEvent->paymentDelete($event);
|
||||
$result = RetailCrmEvent::paymentDelete($event);
|
||||
|
||||
$this->assertEquals(false, $result);
|
||||
}
|
||||
@ -149,7 +144,7 @@ class RetailCrmEventTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
$event = $this->createMock(\Bitrix\Main\Event::class);
|
||||
|
||||
$result = $this->retailcrmEvent->OrderDelete($event);
|
||||
$result = RetailCrmEvent::OrderDelete($event);
|
||||
|
||||
$this->assertEquals(true, $GLOBALS['RETAILCRM_ORDER_DELETE']);
|
||||
}
|
||||
@ -166,7 +161,7 @@ class RetailCrmEventTest extends PHPUnit\Framework\TestCase
|
||||
'ORDER_PROP' => []
|
||||
];
|
||||
|
||||
$result = $this->retailcrmEvent->OnUpdateOrder(1, $arFields);
|
||||
$result = RetailCrmEvent::OnUpdateOrder(1, $arFields);
|
||||
|
||||
$this->assertEquals(true, $GLOBALS['RETAILCRM_ORDER_OLD_EVENT']);
|
||||
|
||||
@ -235,7 +230,7 @@ class RetailCrmEventTest extends PHPUnit\Framework\TestCase
|
||||
];
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
public function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
|
@ -9,7 +9,7 @@ class RetailCrmHistory_v5Test extends \BitrixTestCase
|
||||
/**
|
||||
* setUp method
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -8,7 +8,7 @@ class RetailCrmOrder_v5Test extends BitrixTestCase {
|
||||
/**
|
||||
* setUp method
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -17,7 +17,7 @@ use Tests\Intaro\RetailCrm\Helpers;
|
||||
|
||||
class CustomerBuilderTest extends TestCase
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
Helpers::setConfigProperty('contragentTypes', [
|
||||
'individual' => 'individual'
|
||||
|
@ -5,7 +5,7 @@ use Bitrix\Main\EventManager;
|
||||
|
||||
class EventsHandlersTest extends \BitrixTestCase
|
||||
{
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@ -27,8 +27,7 @@ class EventsHandlersTest extends \BitrixTestCase
|
||||
|
||||
$spy = \Mockery::spy('overload:' .RetailCrmEvent::class);
|
||||
|
||||
$onSaleOrderSaved = new EventsHandlers();
|
||||
$onSaleOrderSaved->OnSaleOrderSavedHandler($event);
|
||||
EventsHandlers::OnSaleOrderSavedHandler($event);
|
||||
|
||||
//Проверяет, был ли вызван метод класса. Если метод не вызывался, выдает ошибку теста
|
||||
//Если метод вызывался, ошибку не выдает, но phpunit выдает сообщение об отсутствии тестов
|
||||
@ -50,9 +49,9 @@ class EventsHandlersTest extends \BitrixTestCase
|
||||
|
||||
$spy = \Mockery::spy('overload:' .RetailCrmEvent::class);
|
||||
|
||||
$onSaleOrderSaved = new EventsHandlers();
|
||||
$onSaleOrderSaved::$disableSaleHandler = true;
|
||||
$onSaleOrderSaved->OnSaleOrderSavedHandler($event);
|
||||
|
||||
EventsHandlers::$disableSaleHandler = true;
|
||||
EventsHandlers::OnSaleOrderSavedHandler($event);
|
||||
|
||||
$spy->shouldNotHaveReceived('orderSave');
|
||||
self::assertTrue(true);
|
||||
|
@ -8,16 +8,18 @@ use Intaro\RetailCrm\Service\LoyaltyAccountService;
|
||||
*/
|
||||
class LoyaltyAccountServiceTest extends BitrixTestCase
|
||||
{
|
||||
|
||||
private LoyaltyAccountService $loyaltyAccountService;
|
||||
/**
|
||||
* setUp method
|
||||
*/
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
COption::SetOptionString('intaro.retailcrm', 'api_version', 'v5');
|
||||
CModule::IncludeModule('intaro.retailcrm');
|
||||
|
||||
$this->loyaltyAccountService = new LoyaltyAccountService();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -28,7 +30,7 @@ class LoyaltyAccountServiceTest extends BitrixTestCase
|
||||
*/
|
||||
public function testProveUserInLpExists(LoyaltyAccountCreateResponse $createResponse, $expected)
|
||||
{
|
||||
self::assertEquals($expected,LoyaltyAccountService::proveUserInLpExists($createResponse));
|
||||
self::assertEquals($expected, $this->loyaltyAccountService->proveUserInLpExists($createResponse));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -39,7 +41,7 @@ class LoyaltyAccountServiceTest extends BitrixTestCase
|
||||
*/
|
||||
public function testNotProveUserInLpExists(LoyaltyAccountCreateResponse $createResponse, $expected)
|
||||
{
|
||||
self::assertEquals($expected,LoyaltyAccountService::proveUserInLpExists($createResponse));
|
||||
self::assertEquals($expected, $this->loyaltyAccountService->proveUserInLpExists($createResponse));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user