mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-22 05:06:07 +03:00
ref #90088 create test
This commit is contained in:
parent
8b7522ca6c
commit
e4cfdd8c9f
@ -41,4 +41,62 @@ class ControllerRetailcrmAdminTest extends TestCase
|
|||||||
$response = $this->dispatchAction('extension/module/retailcrm/uninstall_collector');
|
$response = $this->dispatchAction('extension/module/retailcrm/uninstall_collector');
|
||||||
$this->assertRegExp('/Connection settings/', $response->getOutput());
|
$this->assertRegExp('/Connection settings/', $response->getOutput());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testGetAvailableTypes()
|
||||||
|
{
|
||||||
|
$data = $this->getDataForTestAvailableTypes();
|
||||||
|
$sites = $data['sites'];
|
||||||
|
$types = $data['types'];
|
||||||
|
|
||||||
|
$class = new ReflectionClass(ControllerExtensionModuleRetailcrm::class);
|
||||||
|
$method = $class->getMethod('getAvailableTypes');
|
||||||
|
$method->setAccessible(true);
|
||||||
|
|
||||||
|
$result = $method->invokeArgs(ControllerExtensionModuleRetailcrm::class, [$sites, $types]);
|
||||||
|
|
||||||
|
$this->assertNotEmpty($result['opencart']);
|
||||||
|
$this->assertNotEmpty($result['retailcrm']);
|
||||||
|
$this->assertCount(2, $result['retailcrm']);
|
||||||
|
$this->assertNotEmpty($result['retailcrm']['test1']['code']);
|
||||||
|
$this->assertNotEmpty($result['retailcrm']['test4']['code']);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getDataForTestAvailableTypes(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'sites' => [
|
||||||
|
'opencart' => [
|
||||||
|
'code' => 'opencart',
|
||||||
|
'name' => 'OpenCart'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'types' => [
|
||||||
|
'opencart' => [
|
||||||
|
'test'
|
||||||
|
],
|
||||||
|
'retailcrm' => [
|
||||||
|
'test1' => [
|
||||||
|
'active' => true,
|
||||||
|
'sites' => [],
|
||||||
|
'code' => 'test1'
|
||||||
|
],
|
||||||
|
'test2' => [
|
||||||
|
'active' => false,
|
||||||
|
'sites' => [],
|
||||||
|
'code' => 'test2'
|
||||||
|
],
|
||||||
|
'test3' => [
|
||||||
|
'active' => true,
|
||||||
|
'sites' => ['otherSite'],
|
||||||
|
'code' => 'test3'
|
||||||
|
],
|
||||||
|
'test4' => [
|
||||||
|
'active' => 'true',
|
||||||
|
'sites' => ['cms1', 'cms2', 'opencart'],
|
||||||
|
'code' => 'test4'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user