|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace hipanel\modules\server\tests\acceptance\seller; |
|
4
|
|
|
|
|
5
|
|
|
use hipanel\helpers\Url; |
|
6
|
|
|
use hipanel\tests\_support\Page\IndexPage; |
|
7
|
|
|
use hipanel\tests\_support\Page\Widget\Input\Input; |
|
8
|
|
|
use hipanel\tests\_support\Page\Widget\Input\Select2; |
|
9
|
|
|
use hipanel\tests\_support\Step\Acceptance\Seller; |
|
10
|
|
|
|
|
11
|
|
|
class ServerCest |
|
12
|
|
|
{ |
|
13
|
|
|
/** |
|
14
|
|
|
* @var IndexPage |
|
15
|
|
|
*/ |
|
16
|
|
|
private $index; |
|
17
|
|
|
|
|
18
|
|
|
public function _before(Seller $I) |
|
19
|
|
|
{ |
|
20
|
|
|
$this->index = new IndexPage($I); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
public function ensureIndexPageWorks(Seller $I) |
|
24
|
|
|
{ |
|
25
|
|
|
$I->login(); |
|
26
|
|
|
$I->needPage(Url::to('@server')); |
|
27
|
|
|
$I->see('Servers', 'h1'); |
|
28
|
|
|
$I->seeLink('Buy server', Url::to('/server/order/index')); |
|
29
|
|
|
$this->ensureICanSeeAdvancedSearchBox(); |
|
30
|
|
|
$this->ensureICanSeeLegendBox(); |
|
31
|
|
|
$this->ensureICanSeeBulkServerSearchBox(); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
private function ensureICanSeeAdvancedSearchBox() |
|
35
|
|
|
{ |
|
36
|
|
|
$this->index->containsFilters([ |
|
37
|
|
|
new Input('Name'), |
|
38
|
|
|
new Input('Internal note'), |
|
39
|
|
|
new Input('Order'), |
|
40
|
|
|
new Input('DC'), |
|
41
|
|
|
new Input('IP'), |
|
42
|
|
|
new Select2('Client'), |
|
43
|
|
|
new Select2('Reseller'), |
|
44
|
|
|
new Input('HW summary'), |
|
45
|
|
|
new Input('Type'), |
|
46
|
|
|
new Input('Status'), |
|
47
|
|
|
new Input('Switch'), |
|
48
|
|
|
new Input('KVM'), |
|
49
|
|
|
new Input('APC'), |
|
50
|
|
|
new Input('Rack'), |
|
51
|
|
|
new Input('MAC'), |
|
52
|
|
|
new Input('Tariff'), |
|
53
|
|
|
]); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
private function ensureICanSeeLegendBox() |
|
57
|
|
|
{ |
|
58
|
|
|
$this->index->containsLegend([ |
|
59
|
|
|
'unused: UU', |
|
60
|
|
|
'setup: SETUP', |
|
61
|
|
|
'delivery: DLVR', |
|
62
|
|
|
'reserved: RSVD', |
|
63
|
|
|
'dedicated: DSS', |
|
64
|
|
|
'unmanaged: DSU', |
|
65
|
|
|
'virtual: SH', |
|
66
|
|
|
'system: IU', |
|
67
|
|
|
'remote: RS', |
|
68
|
|
|
'vdsmaster: VM', |
|
69
|
|
|
'vds: VDS', |
|
70
|
|
|
'avdsnode: aVDSnode', |
|
71
|
|
|
'avds: XEN', |
|
72
|
|
|
'ovds: OpenVZ', |
|
73
|
|
|
'svds: XENSSD', |
|
74
|
|
|
'cdn: vCDN.service', |
|
75
|
|
|
'cdnv2: vCDN.node', |
|
76
|
|
|
'cdnpix: pCDN.service', |
|
77
|
|
|
'cdnstat: pCDN.node', |
|
78
|
|
|
'cloudstorage: CLDStor.node', |
|
79
|
|
|
'jail: JL', |
|
80
|
|
|
'nic: NC', |
|
81
|
|
|
'uplink1: U1', |
|
82
|
|
|
'uplink2: U2', |
|
83
|
|
|
'uplink3: U3', |
|
84
|
|
|
'total: TOTAL', |
|
85
|
|
|
'transit: TS', |
|
86
|
|
|
'stock: STOCK', |
|
87
|
|
|
'deleted: DEL', |
|
88
|
|
|
'office: OFFICE', |
|
89
|
|
|
]); |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
private function ensureICanSeeBulkServerSearchBox() |
|
93
|
|
|
{ |
|
94
|
|
|
$this->index->containsBulkButtons([ |
|
95
|
|
|
'Sell', |
|
96
|
|
|
'Basic actions', |
|
97
|
|
|
]); |
|
98
|
|
|
$this->index->containsColumns([ |
|
99
|
|
|
'Name', |
|
100
|
|
|
'Client', |
|
101
|
|
|
'Reseller', |
|
102
|
|
|
'IPs', |
|
103
|
|
|
'Status', |
|
104
|
|
|
'Expires', |
|
105
|
|
|
'Tariff', |
|
106
|
|
|
], 'common'); |
|
|
|
|
|
|
107
|
|
|
$this->index->containsColumns([ |
|
108
|
|
|
'IPs', |
|
109
|
|
|
'Client', |
|
110
|
|
|
'DC', |
|
111
|
|
|
'Name', |
|
112
|
|
|
'Order', |
|
113
|
|
|
], 'short'); |
|
114
|
|
|
$this->index->containsColumns([ |
|
115
|
|
|
'Rack', |
|
116
|
|
|
'Client', |
|
117
|
|
|
'DC', |
|
118
|
|
|
'Name', |
|
119
|
|
|
'HW summary', |
|
120
|
|
|
], 'hardware'); |
|
121
|
|
|
$this->index->containsColumns([ |
|
122
|
|
|
'Client', |
|
123
|
|
|
'Rack', |
|
124
|
|
|
'Name', |
|
125
|
|
|
'Tariff', |
|
126
|
|
|
'HW summary', |
|
127
|
|
|
], 'manager'); |
|
128
|
|
|
$this->index->containsColumns([ |
|
129
|
|
|
'DC', |
|
130
|
|
|
'Name', |
|
131
|
|
|
'Type', |
|
132
|
|
|
'Switch', |
|
133
|
|
|
'KVM', |
|
134
|
|
|
'IPMI', |
|
135
|
|
|
'APC', |
|
136
|
|
|
'IP', |
|
137
|
|
|
'MAC', |
|
138
|
|
|
], 'admin'); |
|
139
|
|
|
} |
|
140
|
|
|
} |
|
141
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.