mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-25 14:46:06 +03:00
42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?php
|
|
|
|
require_once __DIR__ . '/../' . getenv('TEST_SUITE') . '/TestCase.php';
|
|
|
|
class RetailcrmTest extends TestCase {
|
|
|
|
public function testGetOrderManager() {
|
|
$retailcrm = new retailcrm\Retailcrm(static::$registry);
|
|
|
|
$proxy = $this->getMockBuilder(\RetailcrmProxy::class)
|
|
->disableOriginalConstructor()
|
|
->getMock();
|
|
|
|
static::$registry->set(\RetailcrmProxy::class, $proxy);
|
|
$manager = $retailcrm->getOrderManager();
|
|
|
|
$this->assertInstanceOf(\retailcrm\service\OrderManager::class, $manager);
|
|
}
|
|
|
|
public function testGetWeightOption() {
|
|
$retailCrm = new \retailcrm\Retailcrm(self::$registry);
|
|
|
|
$reflection = new ReflectionClass($retailCrm);
|
|
$reflectionMethod = $reflection->getMethod('getWeightOption');
|
|
$reflectionMethod->setAccessible('true');
|
|
|
|
$result = $reflectionMethod->invokeArgs(
|
|
$retailCrm,
|
|
[['weight_prefix' => '+', 'weight' => 5]]
|
|
);
|
|
|
|
$this->assertEquals(5, $result);
|
|
|
|
$result = $reflectionMethod->invokeArgs(
|
|
$retailCrm,
|
|
[['weight_prefix' => '-', 'weight' => 5]]
|
|
);
|
|
|
|
$this->assertEquals(-5, $result);;
|
|
}
|
|
}
|