|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Copyright © MIKO LLC - All Rights Reserved |
|
4
|
|
|
* Unauthorized copying of this file, via any medium is strictly prohibited |
|
5
|
|
|
* Proprietary and confidential |
|
6
|
|
|
* Written by Alexey Portnov, 2 2020 |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace MikoPBX\Tests\Service\License; |
|
10
|
|
|
|
|
11
|
|
|
use MikoPBX\Common\Models\Extensions; |
|
12
|
|
|
use MikoPBX\Service\License; |
|
13
|
|
|
use MikoPBX\Tests\Unit\AbstractUnitTest; |
|
14
|
|
|
|
|
15
|
|
|
class LicenseTest extends AbstractUnitTest |
|
16
|
|
|
{ |
|
17
|
|
|
protected License $lic; |
|
18
|
|
|
|
|
19
|
|
|
public function __construct($name = null, array $data = [], $dataName = '') |
|
20
|
|
|
{ |
|
21
|
|
|
parent::__construct($name, $data, $dataName); |
|
22
|
|
|
$this->lic = new License("http://127.0.0.1:8223"); |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
public function testCheckModules():void |
|
26
|
|
|
{ |
|
27
|
|
|
$this->lic->checkModules(); |
|
28
|
|
|
$this->assertTrue(true); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function testGetTrialLicense():void |
|
32
|
|
|
{ |
|
33
|
|
|
$data = [ |
|
34
|
|
|
"companyname" => "MIKO", |
|
35
|
|
|
"email" => "[email protected]", |
|
36
|
|
|
"contact" => "Nikolay Beketov", |
|
37
|
|
|
"telefone" => "+79265244742", |
|
38
|
|
|
"inn" => "7894564153" |
|
39
|
|
|
]; |
|
40
|
|
|
$result = $this->lic->getTrialLicense($data); |
|
|
|
|
|
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function testCaptureFeature():void |
|
44
|
|
|
{ |
|
45
|
|
|
$result = $this->lic->captureFeature(33); |
|
|
|
|
|
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function testReleaseFeature():void |
|
49
|
|
|
{ |
|
50
|
|
|
$result = $this->lic->releaseFeature(33); |
|
|
|
|
|
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function testAddTrial():void |
|
54
|
|
|
{ |
|
55
|
|
|
$result = $this->lic->addTrial(11); |
|
|
|
|
|
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function testActivateCoupon():void |
|
59
|
|
|
{ |
|
60
|
|
|
$result = $this->lic->activateCoupon(''); |
|
|
|
|
|
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function testGetLicenseInfo():void |
|
64
|
|
|
{ |
|
65
|
|
|
$result = $this->lic->getLicenseInfo(''); |
|
|
|
|
|
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function testChangeLicenseKey():void |
|
69
|
|
|
{ |
|
70
|
|
|
$this->lic->changeLicenseKey(''); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function testCheckPBX():void |
|
74
|
|
|
{ |
|
75
|
|
|
$this->lic->checkPBX(); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
public function testFeatureAvailable():void |
|
79
|
|
|
{ |
|
80
|
|
|
$result = $this->lic->featureAvailable(33); |
|
|
|
|
|
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
public function testSendLicenseMetrics():void |
|
84
|
|
|
{ |
|
85
|
|
|
// Версия PBX |
|
86
|
|
|
$params['PBXname'] = 'MikoPBX@' . file_get_contents("/etc/version"); |
|
|
|
|
|
|
87
|
|
|
|
|
88
|
|
|
// Количество Extensions |
|
89
|
|
|
$extensions = Extensions::find('type="SIP"'); |
|
90
|
|
|
$params['CountSipExtensions'] = $extensions->count(); |
|
91
|
|
|
|
|
92
|
|
|
$result = $this->lic->sendLicenseMetrics("", $params); |
|
|
|
|
|
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
|
|
98
|
|
|
|
|
99
|
|
|
|
|
100
|
|
|
|
|
101
|
|
|
|