mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-28 08:06:05 +03:00
45 lines
1.7 KiB
PHP
45 lines
1.7 KiB
PHP
<?php
|
|
|
|
require_once __DIR__ . '/../' . getenv('TEST_SUITE') . '/TestCase.php';
|
|
|
|
class ControllerRetailcrmAdminTest extends TestCase
|
|
{
|
|
const MODULE_TITLE = 'retailcrm';
|
|
|
|
public function setUp()
|
|
{
|
|
parent::setUp();
|
|
|
|
$query = $this->db->query("SELECT permission from ".DB_PREFIX."user_group WHERE name = 'Administrator'");
|
|
$permissions = json_decode($query->row['permission'],true);
|
|
|
|
if (!in_array('extension/module/retailcrm', $permissions['access'])) {
|
|
$permissions['access'][] = 'extension/module/retailcrm';
|
|
$this->db->query("UPDATE ".DB_PREFIX."user_group SET permission='".$this->db->escape(json_encode($permissions))."' WHERE name = 'Administrator'");
|
|
}
|
|
|
|
$this->retailcrm = $this->getMockBuilder('\retailcrm\Retailcrm')
|
|
->disableOriginalConstructor()
|
|
->getMock();
|
|
}
|
|
|
|
public function testController()
|
|
{
|
|
$this->login('admin', 'admin');
|
|
|
|
$response = $this->dispatchAction('extension/module/retailcrm');
|
|
$this->assertRegExp('/Connection settings/', $response->getOutput());
|
|
|
|
$response = $this->dispatchAction('extension/module/retailcrm/icml');
|
|
|
|
$this->assertRegExp('/Connection settings/', $response->getOutput());
|
|
$this->assertFileExists(DIR_SYSTEM . '../' . 'retailcrm.xml');
|
|
|
|
$response = $this->dispatchAction('extension/module/retailcrm/install_collector');
|
|
$this->assertRegExp('/Connection settings/', $response->getOutput());
|
|
|
|
$response = $this->dispatchAction('extension/module/retailcrm/uninstall_collector');
|
|
$this->assertRegExp('/Connection settings/', $response->getOutput());
|
|
}
|
|
}
|