1
0
mirror of synced 2024-11-25 14:56:09 +03:00
bitrix-module/tests/lib/icml/SettingServiceTest.php

50 lines
1.4 KiB
PHP
Raw Normal View History

<?php
namespace lib\icml;
use Intaro\RetailCrm\Icml\SettingsService;
class SettingServiceTest extends \BitrixTestCase
{
private $mockSettingService;
public function setUp(): void
{
parent::setUp();
$this->mockSettingService = $this->getMockBuilder(SettingsService::class)
->disableOriginalConstructor()
->getMock()
;
}
public function testConstruct(): SettingsService
{
$path = $_SERVER['DOCUMENT_ROOT'] . '/local/';
CheckDirPath($path);
$file = new \Bitrix\Main\IO\File($path . '/icml_property_retailcrm.txt', $siteId = null);
$file->putContents("property1 = test prop \n property2 = test prop 2");
$settingService = SettingsService::getInstance($this->getSetupVars(), "");
$this->assertInstanceOf(SettingsService::class, $settingService);
$this->assertArrayHasKey('property1', $settingService->actrualPropList);
$this->assertArrayHasKey('property2', $settingService->actrualPropList);
return $settingService;
}
private function getSetupVars()
{
return [
'iblockExport' => 2,
'loadPurchasePrice' => "",
'loadNonActivity' => "",
'SETUP_FILE_NAME' => "/bitrix/catalog_export/retailcrm.xml",
'SETUP_PROFILE_NAME' => "Выгрузка каталога RetailCRM"
];
}
}