1
0
mirror of synced 2025-02-12 04:59:22 +03:00
bitrix-module/tests/classes/general/AddressBuilderTest.php
Neur0toxine 5f69051859
Программа лояльности
* New module structure (refactoring)
* Simple serializer and deserializer with models, new architecture
* Move logic to strategies
* Partial api client facade implementation (full implementation is not necessary for now)
* Loyalty feature installer
* Sms verification order (#167)
* Make updater self-sufficient
* Fix for order submit & fix for incorrect component rendering in the constructor
* Fix for loyalty personal area error handling
* Fix for cart component identity
* Fix for softlock when customer cannot be registered in loyalty

Co-authored-by: Сергей Чазов <45812598+Chazovs@users.noreply.github.com>
Co-authored-by: Sergey Chazov <oitv18@gmail.com>
2021-11-16 10:48:26 +03:00

69 lines
2.6 KiB
PHP
Executable File
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 AddressBuilderTest
*/
class AddressBuilderTest extends \PHPUnit\Framework\TestCase
{
/**@var object $addressBuilder */
public $addressBuilder;
/**@var array $dataCrm */
protected $dataCrm;
public function setUp()
{
parent::setUp();
}
public function testAddressBuild()
{
$this->addressBuilder = new AddressBuilder();
$this->addressBuilder->setDataCrm($this->getDataBuilder())->build();
$this->assertNotEmpty($this->addressBuilder);
$addressResult = $this->addressBuilder->getCustomerAddress()->getObjectToArray();
$this->assertEquals("346000", $addressResult["index"]);
$this->assertEquals("RU", $addressResult["country"]);
$this->assertEquals("Ростовская область", $addressResult["region"]);
$this->assertEquals("Ростов-на-Дону", $addressResult["city"]);
$this->assertEquals("Большая Садовая", $addressResult["street"]);
$this->assertEquals("3", $addressResult["building"]);
$this->assertEquals("3", $addressResult["flat"]);
$this->assertEquals("3", $addressResult["floor"]);
$this->assertEquals("3", $addressResult["block"]);
$this->assertEquals("3", $addressResult["house"]);
$this->assertEquals("Дополнительная информация", $addressResult["notes"]);
$this->assertEquals(
"ул. Большая Садовая, д. 3, стр. 3, корп. 3, кв./офис 3, под. 3, эт. 3, Дополнительная информация",
$addressResult["text"]
);
}
private function getDataBuilder()
{
return array(
"id" => "13743",
"index" => "346000",
"countryIso" => "RU",
"region" => "Ростовская область",
"regionId" => "73",
"city" => "Ростов-на-Дону",
"cityId" => "4298",
"cityType" => "г.",
"street" => "Большая Садовая",
"streetId" => "1583457",
"streetType" => "ул.",
"building" => "3",
"flat" => "3",
"floor" => "3",
"block" =>"3",
"house" => "3",
"housing" => "3",
"notes" => "Дополнительная информация",
"text" => "ул. Большая Садовая, д. 3, стр. 3, корп. 3, кв./офис 3, под. 3, эт. 3, Дополнительная информация",
);
}
}