1
0
mirror of synced 2024-11-30 09:16:06 +03:00
bitrix-module/tests/classes/general/CustomerBuilderTest.php
Neur0toxine 09f82bcfdf
Customer change
* remove useless request for history
* append new address to corporate customer
* centralized configuration provider
* use companyName filter in event & pass companyName into order
* add AdressBuilder* fixed for regressions
* fixed double contact problem
2020-07-14 13:47:26 +03:00

93 lines
3.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* Class CustomerBuilderTest
*/
class CustomerBuilderTest extends \PHPUnit\Framework\TestCase
{
/**@var object $customer */
public $customer;
/**@var object $addressBuilder */
public $addressBuilder;
/**@var array $dataCrm */
protected $dataCrm;
public function setUp()
{
parent::setUp();
}
public function testCustomerBuild()
{
$this->customer = new CustomerBuilder();
$this->customer->setDataCrm($this->getDataBuilder())->build();
$this->assertNotEmpty($this->customer);
$addressResult = $this->customer->getCustomer()->getObjectToArray();
$this->assertEquals("mm@mm.mmm", $addressResult["EMAIL"]);
$this->assertEquals("mmm", $addressResult["NAME"]);
$this->assertEquals("mmm", $addressResult["LAST_NAME"]);
$this->assertEquals("mmm", $addressResult["SECOND_NAME"]);
$this->assertEquals("474747856878", $addressResult["PERSONAL_PHONE"]);
$this->assertEquals("346000", $addressResult["PERSONAL_ZIP"]);
$this->assertEquals("Ростов-на-Дону", $addressResult["PERSONAL_CITY"]);
$this->assertEquals("13.05.2020", $addressResult["PERSONAL_BIRTHDAY"]);
$this->assertEquals("female", $addressResult["PERSONAL_GENDER"]);
}
private function getDataBuilder()
{
return array(
"type"=>"customer",
"id"=> 20250,
"createdAt"=> "2020-05-13 16:34:54",
"site"=> "bitrix-local",
"marginSumm"=> 0,
"totalSumm"=> 0,
"averageSumm"=> 0,
"ordersCount"=> 0,
"customFields"=> array(
"faxcliente"=> "11",
"tipodecliente"=> "11",
),
"personalDiscount"=> 0,
"cumulativeDiscount"=> 0,
"address"=> array(
"id"=> 13748,
"index"=> "346000",
"countryIso"=>"RU",
"region"=>"Ростовская область",
"regionId"=> 73,
"city"=> "Ростов-на-Дону",
"cityId"=> 4298,
"cityType"=> "г.",
"street"=> "Большая Садовая",
"streetId"=> 1583457,
"streetType"=>"ул.",
"building"=>"1",
"flat"=> "1",
"floor"=> "1",
"block"=> "1",
"house"=> "1",
"housing"=> "1",
"notes"=> "111",
"text"=>"ул. Большая Садовая, д. 1, стр. 1, корп. 1, кв./офис 1, под. 1, эт. 1, 111",
),
"firstName"=> "mmm",
"lastName"=> "mmm",
"patronymic"=> "mmm",
"sex"=> "female",
"email"=> "mm@mm.mmm",
"phones"=> array(
"0" => array(
"number"=> "474747856878",
)
),
"birthday"=> "2020-05-13",
"create"=> 1
);
}
}