2020-09-25 12:31:45 +03:00
|
|
|
<?php
|
2022-03-02 15:40:53 +03:00
|
|
|
|
2020-09-25 12:31:45 +03:00
|
|
|
/**
|
|
|
|
* Class BitrixTestCase
|
|
|
|
*/
|
|
|
|
class BitrixTestCase extends \PHPUnit\Framework\TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
protected $backupGlobals = false;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var \Generator
|
|
|
|
*/
|
|
|
|
protected $faker;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* этот метод phpUnit вызывает перед запуском текущего теста
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
2023-03-15 11:55:04 +03:00
|
|
|
public function setUp(): void
|
2020-09-25 12:31:45 +03:00
|
|
|
{
|
|
|
|
// создание экземпляра Faker, который будет создавать рандомные данные
|
|
|
|
$this->faker = \Faker\Factory::create();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* этот метод phpUnit вызывает после исполнения текущего теста
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
2023-03-15 11:55:04 +03:00
|
|
|
public function tearDown(): void
|
2020-09-25 12:31:45 +03:00
|
|
|
{
|
|
|
|
// без этого вызова Mockery не будет работать
|
|
|
|
\Mockery::close();
|
|
|
|
}
|
2021-09-08 13:00:50 +03:00
|
|
|
|
|
|
|
public function getArFields(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'ID' => 1,
|
|
|
|
'NUMBER' => "1",
|
|
|
|
'USER_ID' => "1",
|
|
|
|
'STATUS_ID' => "1",
|
|
|
|
'PERSON_TYPE_ID' => 'bitrixType',
|
|
|
|
'DATE_INSERT' => '2015-02-22 00:00:00',
|
|
|
|
'USER_DESCRIPTION' => 'userComment',
|
|
|
|
'COMMENTS' => 'managerComment',
|
|
|
|
'PRICE_DELIVERY' => '100',
|
2023-12-19 17:13:31 +03:00
|
|
|
'PROPS' => [
|
|
|
|
'properties' => [
|
|
|
|
['CODE' => 'FIO', 'VALUE' => ['FirstName LastName']],
|
|
|
|
['ID' => 1, 'CODE' => 'TEST_PROP_1', 'VALUE' => ['test 1']],
|
|
|
|
['ID' => 2, 'CODE' => 'TEST_PROP_2', 'VALUE' => ['test 2']]
|
|
|
|
]
|
|
|
|
],
|
2021-09-08 13:00:50 +03:00
|
|
|
'DELIVERYS' => [[
|
|
|
|
'id' => 'test',
|
|
|
|
'service' => 'service'
|
|
|
|
]],
|
|
|
|
'BASKET' => [],
|
|
|
|
'PAYMENTS' => [[
|
|
|
|
'ID' => 1,
|
|
|
|
'PAY_SYSTEM_ID' => 1,
|
|
|
|
'SUM' => 1000,
|
|
|
|
'DATE_PAID' => $this->getDateTime(),
|
|
|
|
'PAID' => 'Y'
|
2022-12-05 16:32:28 +03:00
|
|
|
]],
|
|
|
|
'REASON_CANCELED' => 'test comment'
|
2021-09-08 13:00:50 +03:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDateTime(): \Bitrix\Main\Type\DateTime
|
|
|
|
{
|
|
|
|
return \Bitrix\Main\Type\DateTime::createFromPhp(new DateTime('2000-01-01'));
|
|
|
|
}
|
2020-09-25 12:31:45 +03:00
|
|
|
}
|