commit
6e9629efef
@ -1,3 +1,6 @@
|
|||||||
|
## 2018-12-25 v.2.4.1
|
||||||
|
* Удалена генерация externalId покупателя при заказе от незарегестрированного пользователя
|
||||||
|
|
||||||
## 2018-12-25 v.2.4.0
|
## 2018-12-25 v.2.4.0
|
||||||
* Добавлен функционал получения остатков из retailCRM
|
* Добавлен функционал получения остатков из retailCRM
|
||||||
|
|
||||||
|
@ -69,7 +69,6 @@ class Customer implements CustomerManagerInterface
|
|||||||
$billing = $order->getBillingAddress();
|
$billing = $order->getBillingAddress();
|
||||||
|
|
||||||
$preparedCustomer = [
|
$preparedCustomer = [
|
||||||
'externalId' => uniqid(),
|
|
||||||
'email' => $billing->getEmail(),
|
'email' => $billing->getEmail(),
|
||||||
'firstName' => $billing->getFirstname(),
|
'firstName' => $billing->getFirstname(),
|
||||||
'patronymic' => $billing->getMiddlename(),
|
'patronymic' => $billing->getMiddlename(),
|
||||||
|
@ -7,6 +7,8 @@ class CustomerTest extends \PHPUnit\Framework\TestCase
|
|||||||
private $mockData;
|
private $mockData;
|
||||||
private $mockCustomer;
|
private $mockCustomer;
|
||||||
private $unit;
|
private $unit;
|
||||||
|
private $mockOrder;
|
||||||
|
private $mockBillingAddress;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
@ -29,6 +31,59 @@ class CustomerTest extends \PHPUnit\Framework\TestCase
|
|||||||
'getAddressesCollection'
|
'getAddressesCollection'
|
||||||
])
|
])
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
|
$this->mockOrder = $this->getMockBuilder(\Magento\Sales\Model\Order::class)
|
||||||
|
->disableOriginalConstructor()
|
||||||
|
->setMethods([
|
||||||
|
'getBillingAddress',
|
||||||
|
])
|
||||||
|
->getMock();
|
||||||
|
|
||||||
|
$this->mockBillingAddress = $this->getMockBuilder(\Magento\Customer\Model\Address\AddressModelInterface::class)
|
||||||
|
->disableOriginalConstructor()
|
||||||
|
->setMethods([
|
||||||
|
'getTelephone',
|
||||||
|
'getEmail',
|
||||||
|
'getData',
|
||||||
|
'getFirstname',
|
||||||
|
'getMiddlename',
|
||||||
|
'getLastname',
|
||||||
|
'getCountryId',
|
||||||
|
'getPostcode',
|
||||||
|
'getRegion',
|
||||||
|
'getCity',
|
||||||
|
'getStreet'
|
||||||
|
])
|
||||||
|
->getMockForAbstractClass();
|
||||||
|
|
||||||
|
$this->unit = new \Retailcrm\Retailcrm\Model\Service\Customer(
|
||||||
|
$this->mockData
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPrepareCustomerFromOrder()
|
||||||
|
{
|
||||||
|
$this->mockOrder->expects($this->any())
|
||||||
|
->method('getBillingAddress')
|
||||||
|
->willReturn($this->mockBillingAddress);
|
||||||
|
|
||||||
|
$result = $this->unit->prepareCustomerFromOrder($this->mockOrder);
|
||||||
|
|
||||||
|
$this->assertNotEmpty($result);
|
||||||
|
$this->assertInternalType('array', $result);
|
||||||
|
$this->assertArrayNotHasKey('externalId', $result);
|
||||||
|
$this->assertArrayHasKey('email', $result);
|
||||||
|
$this->assertArrayHasKey('firstName', $result);
|
||||||
|
$this->assertArrayHasKey('lastName', $result);
|
||||||
|
$this->assertArrayHasKey('patronymic', $result);
|
||||||
|
$this->assertArrayHasKey('address', $result);
|
||||||
|
$this->assertInternalType('array', $result['address']);
|
||||||
|
$this->assertArrayHasKey('countryIso', $result['address']);
|
||||||
|
$this->assertArrayHasKey('index', $result['address']);
|
||||||
|
$this->assertArrayHasKey('region', $result['address']);
|
||||||
|
$this->assertArrayHasKey('city', $result['address']);
|
||||||
|
$this->assertArrayHasKey('street', $result['address']);
|
||||||
|
$this->assertArrayHasKey('text', $result['address']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,10 +162,6 @@ class CustomerTest extends \PHPUnit\Framework\TestCase
|
|||||||
->method('getAddressesCollection')
|
->method('getAddressesCollection')
|
||||||
->willReturn([$mockAddress]);
|
->willReturn([$mockAddress]);
|
||||||
|
|
||||||
$this->unit = new \Retailcrm\Retailcrm\Model\Service\Customer(
|
|
||||||
$this->mockData
|
|
||||||
);
|
|
||||||
|
|
||||||
$result = $this->unit->process($this->mockCustomer);
|
$result = $this->unit->process($this->mockCustomer);
|
||||||
|
|
||||||
$this->assertNotEmpty($result);
|
$this->assertNotEmpty($result);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"retailcrm/api-client-php": "~5.0"
|
"retailcrm/api-client-php": "~5.0"
|
||||||
},
|
},
|
||||||
"type": "magento2-module",
|
"type": "magento2-module",
|
||||||
"version": "2.4.0",
|
"version": "2.4.1",
|
||||||
"license": [
|
"license": [
|
||||||
"OSL-3.0",
|
"OSL-3.0",
|
||||||
"AFL-3.0"
|
"AFL-3.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user