mirror of
https://github.com/retailcrm/opencart-module.git
synced 2025-04-04 05:43:37 +03:00
add test
This commit is contained in:
parent
6a78711e9d
commit
ee53766913
1 changed files with 37 additions and 0 deletions
37
tests/admin/ModelRetailcrmInventoryAdminTest.php
Normal file
37
tests/admin/ModelRetailcrmInventoryAdminTest.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__ . '/../' . getenv('TEST_SUITE') . '/TestCase.php';
|
||||
|
||||
class ModelRetailcrmInventoryAdminTest extends TestCase
|
||||
{
|
||||
private $inventoriesModel;
|
||||
private $apiClientMock;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->inventoriesModel = $this->loadModel('extension/retailcrm/inventories');
|
||||
|
||||
$this->apiClientMock = $this->getMockBuilder(\RetailcrmProxy::class)
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(array(
|
||||
'storeInventoriesUpload',
|
||||
))
|
||||
->getMock();
|
||||
|
||||
self::$registry->set(\RetailcrmProxy::class, $this->apiClientMock);
|
||||
}
|
||||
|
||||
public function testUploadToCrm()
|
||||
{
|
||||
$productModel = $this->loadModel('catalog/product');
|
||||
$product = $productModel->getProducts([]);
|
||||
$productSend = $this->inventoriesModel->uploadToCrm($product, $this->apiClientMock);
|
||||
$product= $productSend[0][0];
|
||||
|
||||
$this->assertInternalType('array', $productSend);
|
||||
$this->assertArrayHasKey('externalId', $product);
|
||||
$this->assertArrayHasKey('stores', $product);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue