Passed
Push — develop ( 3c5942...636dd4 )
by Nikolay
04:57
created

LicenseTest::testActivateCoupon()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 0
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);
0 ignored issues
show
Unused Code introduced by
The assignment to $result is dead and can be removed.
Loading history...
41
    }
42
43
    public function testCaptureFeature():void
44
    {
45
        $result = $this->lic->captureFeature(33);
0 ignored issues
show
Unused Code introduced by
The assignment to $result is dead and can be removed.
Loading history...
46
    }
47
48
    public function testReleaseFeature():void
49
    {
50
        $result = $this->lic->releaseFeature(33);
0 ignored issues
show
Unused Code introduced by
The assignment to $result is dead and can be removed.
Loading history...
51
    }
52
53
    public function testAddTrial():void
54
    {
55
        $result = $this->lic->addTrial(11);
0 ignored issues
show
Unused Code introduced by
The assignment to $result is dead and can be removed.
Loading history...
56
    }
57
58
    public function testActivateCoupon():void
59
    {
60
        $result = $this->lic->activateCoupon('');
0 ignored issues
show
Unused Code introduced by
The assignment to $result is dead and can be removed.
Loading history...
61
    }
62
63
    public function testGetLicenseInfo():void
64
    {
65
        $result = $this->lic->getLicenseInfo('');
0 ignored issues
show
Unused Code introduced by
The assignment to $result is dead and can be removed.
Loading history...
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);
0 ignored issues
show
Unused Code introduced by
The assignment to $result is dead and can be removed.
Loading history...
81
    }
82
83
    public function testSendLicenseMetrics():void
84
    {
85
        // Версия PBX
86
        $params['PBXname'] = 'MikoPBX@' . file_get_contents("/etc/version");
0 ignored issues
show
Comprehensibility Best Practice introduced by
$params was never initialized. Although not strictly required by PHP, it is generally a good practice to add $params = array(); before regardless.
Loading history...
87
88
        // Количество Extensions
89
        $extensions                   = Extensions::find('type="SIP"');
90
        $params['CountSipExtensions'] = $extensions->count();
91
92
        $result = $this->lic->sendLicenseMetrics("", $params);
0 ignored issues
show
Unused Code introduced by
The assignment to $result is dead and can be removed.
Loading history...
93
    }
94
95
}
96
97
98
99
100
101