1
0
Fork 0
mirror of synced 2025-04-11 05:00:55 +00:00
Добавление проверок на активность опции
Обновление тестов
This commit is contained in:
Ivan Chaplygin 2023-12-08 09:18:14 +03:00
parent 775c5b972e
commit ad7ed2056e
2 changed files with 17 additions and 2 deletions

View file

@ -67,7 +67,12 @@ class RetailCrmHistory
$matchedCustomFields = RetailcrmConfigProvider::getMatchedUserFields() ?? [];
$matchedCustomFields = array_flip($matchedCustomFields);
self::$CUSTOM_FIELDS_IS_ACTIVE = RetailcrmConfigProvider::getCustomFieldsStatus();
$customUserFieldTypes = RCrmActions::getTypeUserField();
$customUserFieldTypes = [];
if (self::$CUSTOM_FIELDS_IS_ACTIVE === 'Y') {
$customUserFieldTypes = RCrmActions::getTypeUserField();
}
if ($historyStart && $historyStart > 0) {
$historyFilter['sinceId'] = $historyStart;
@ -279,7 +284,11 @@ class RetailCrmHistory
self::$CUSTOM_FIELDS_IS_ACTIVE = RetailcrmConfigProvider::getCustomFieldsStatus();
$customUserFieldTypes = RCrmActions::getTypeUserField();
$customUserFieldTypes = [];
if (self::$CUSTOM_FIELDS_IS_ACTIVE === 'Y') {
$customUserFieldTypes = RCrmActions::getTypeUserField();
}
$api = new RetailCrm\ApiClient(RetailcrmConfigProvider::getApiUrl(), RetailcrmConfigProvider::getApiKey());
$page = 1;

View file

@ -39,6 +39,10 @@ class RetailCrmHistory_v5Test extends \BitrixTestCase
$apiResponse = new ApiResponse(200, DataHistory::get_history_data_new_customer());
$actionsMock->shouldReceive('apiMethod')->withAnyArgs()->andReturn($apiResponse);
$actionsMock->shouldReceive('getTypeUserField')->withAnyArgs()->andReturn([
'UF_FIELD_USER_1' => 'string', 'UF_FIELD_USER_2' => 'string'
]);
$actionsMock->shouldReceive('convertCrmValueToFieldUser')->byDefault();
$this->deleteTestingUser();
RetailCrmHistory::customerHistory();
@ -46,6 +50,8 @@ class RetailCrmHistory_v5Test extends \BitrixTestCase
$dbUser = CUser::GetList(($by = 'ID'), ($sort = 'DESC'), ['=EMAIL' => 'testbitrixreg@gmail.com']);
$this->assertEquals(1, $dbUser->SelectedRowsCount());
RetailcrmConfigProvider::setCustomFieldsStatus('N');
}
/**