opencart-module/tests/admin/ModelRetailcrmCustomerAdminTest.php

45 lines
1.3 KiB
PHP
Raw Normal View History

2018-06-13 16:13:08 +03:00
<?php
2020-02-19 21:50:16 +03:00
require_once __DIR__ . '/../' . getenv('TEST_SUITE') . '/TestCase.php';
2020-02-19 12:37:03 +03:00
class ModelRetailcrmCustomerAdminTest extends TestCase
2018-06-13 16:13:08 +03:00
{
private $customerModel;
private $apiClientMock;
const CUSTOMER_ID = 1;
public function setUp()
{
parent::setUp();
$this->customerModel = $this->loadModel('extension/retailcrm/customer');
$this->apiClientMock = $this->getMockBuilder(\RetailcrmProxy::class)
->disableOriginalConstructor()
->setMethods(array(
'customersUpload',
'customersEdit'
))
->getMock();
self::$registry->set(\RetailcrmProxy::class, $this->apiClientMock);
2018-06-13 16:13:08 +03:00
}
public function testUploadToCrm()
{
$customerModel = $this->loadModel('customer/customer');
$customers = $customerModel->getCustomers();
$customersSend = $this->customerModel->uploadToCrm($customers, $this->apiClientMock);
$customer = $customersSend[0][0];
$this->assertInternalType('array', $customersSend);
$this->assertInternalType('array', $customersSend[0]);
$this->assertArrayHasKey('externalId', $customer);
$this->assertArrayHasKey('firstName', $customer);
$this->assertArrayHasKey('lastName', $customer);
$this->assertArrayHasKey('email', $customer);
}
}