opencart-module/tests/admin/ControllerRetailcrmAdminTest.php

41 lines
1.3 KiB
PHP
Raw Normal View History

2018-06-13 16:13:08 +03:00
<?php
2018-09-27 16:46:04 +03:00
namespace Tests;
2018-06-13 16:13:08 +03:00
class ControllerRetailcrmAdminTest extends OpenCartTest
{
const MODULE_TITLE = 'retailcrm';
public function setUp()
{
2018-09-27 16:46:04 +03:00
parent::setUp();
$query = $this->db->query("SELECT permission from " . DB_PREFIX . "user_group WHERE name = 'Administrator'");
2018-06-13 16:13:08 +03:00
$permissions = json_decode($query->row['permission'],true);
2018-09-27 16:46:04 +03:00
if (!in_array('extension/module/retailcrm', $permissions['access'])) {
2018-06-13 16:13:08 +03:00
$permissions['access'][] = 'extension/module/retailcrm';
$this->db->query("UPDATE ".DB_PREFIX."user_group SET permission='".$this->db->escape(json_encode($permissions))."' WHERE name = 'Administrator'");
}
2018-08-29 17:45:35 +03:00
$this->retailcrm = $this->getMockBuilder('\retailcrm\retailcrm')
2018-06-13 16:13:08 +03:00
->disableOriginalConstructor()
->getMock();
}
public function testIndex()
{
$this->login('admin', 'admin');
$response = $this->dispatchAction('extension/module/retailcrm');
2018-09-27 16:46:04 +03:00
2018-06-13 16:13:08 +03:00
$this->assertRegExp('/Connection settings/', $response->getOutput());
}
public function testIcml()
{
$this->login('admin', 'admin');
2018-09-27 16:46:04 +03:00
$this->dispatchAction('extension/module/retailcrm/icml');
2018-06-13 16:13:08 +03:00
$this->assertFileExists(DIR_SYSTEM . '../' . 'retailcrm.xml');
}
}