1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Hosting Plugin for HiPanel |
4
|
|
|
* |
5
|
|
|
* @link https://github.com/hiqdev/hipanel-module-hosting |
6
|
|
|
* @package hipanel-module-hosting |
7
|
|
|
* @license BSD-3-Clause |
8
|
|
|
* @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/) |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace hipanel\modules\hosting\tests\acceptance\admin; |
12
|
|
|
|
13
|
|
|
use hipanel\helpers\Url; |
14
|
|
|
use hipanel\tests\_support\Page\IndexPage; |
15
|
|
|
use hipanel\tests\_support\Page\Widget\Input\Input; |
16
|
|
|
use hipanel\tests\_support\Page\Widget\Input\Select2; |
17
|
|
|
use hipanel\tests\_support\Step\Acceptance\Admin; |
18
|
|
|
|
19
|
|
View Code Duplication |
class DomainsCest |
|
|
|
|
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @var IndexPage |
23
|
|
|
*/ |
24
|
|
|
private $index; |
25
|
|
|
|
26
|
|
|
public function _before(Admin $I) |
27
|
|
|
{ |
28
|
|
|
$this->index = new IndexPage($I); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function ensureIndexPageWorks(Admin $I) |
32
|
|
|
{ |
33
|
|
|
$I->login(); |
34
|
|
|
$I->needPage(Url::to('@hdomain')); |
35
|
|
|
$I->see('Domains', 'h1'); |
36
|
|
|
$I->see('Create domain', 'a'); |
37
|
|
|
$this->ensureICanSeeAdvancedSearchBox($I); |
38
|
|
|
$this->ensureICanSeeLegendBox(); |
39
|
|
|
$this->ensureICanSeeBulkSearchBox(); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
private function ensureICanSeeAdvancedSearchBox(Admin $I) |
43
|
|
|
{ |
44
|
|
|
$this->index->containsFilters([ |
45
|
|
|
Input::asAdvancedSearch($I, 'Domain name'), |
46
|
|
|
Input::asAdvancedSearch($I, 'Domain list (comma-separated)'), |
47
|
|
|
Input::asAdvancedSearch($I, 'IP'), |
48
|
|
|
Select2::asAdvancedSearch($I, 'Status'), |
49
|
|
|
Select2::asAdvancedSearch($I, 'Show aliases only'), |
50
|
|
|
Select2::asAdvancedSearch($I, 'Client'), |
51
|
|
|
Select2::asAdvancedSearch($I, 'Reseller'), |
52
|
|
|
Select2::asAdvancedSearch($I, 'Server'), |
53
|
|
|
]); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
private function ensureICanSeeLegendBox() |
57
|
|
|
{ |
58
|
|
|
$this->index->containsLegend([ |
59
|
|
|
'Domain', |
60
|
|
|
'DNS records', |
61
|
|
|
'Alias', |
62
|
|
|
'Name server', |
63
|
|
|
'Complex domain', |
64
|
|
|
]); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
private function ensureICanSeeBulkSearchBox() |
68
|
|
|
{ |
69
|
|
|
$this->index->containsBulkButtons([ |
70
|
|
|
'Delete', |
71
|
|
|
]); |
72
|
|
|
$this->index->containsColumns([ |
73
|
|
|
'Domain name', |
74
|
|
|
'Client', |
75
|
|
|
'Reseller', |
76
|
|
|
'Account', |
77
|
|
|
'Server', |
78
|
|
|
'Status', |
79
|
|
|
'IP', |
80
|
|
|
'Service', |
81
|
|
|
]); |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.