1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace hipanel\modules\hosting\tests\acceptance\client; |
4
|
|
|
|
5
|
|
|
use hipanel\helpers\Url; |
6
|
|
|
use hipanel\tests\_support\Page\IndexPage; |
7
|
|
|
use hipanel\tests\_support\Step\Acceptance\Client; |
8
|
|
|
|
9
|
|
|
class AccountsCest |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* @var IndexPage |
13
|
|
|
*/ |
14
|
|
|
private $index; |
15
|
|
|
|
16
|
|
|
public function _before(Client $I) |
17
|
|
|
{ |
18
|
|
|
$this->index = new IndexPage($I); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
View Code Duplication |
public function ensureIndexPageWorks(Client $I) |
|
|
|
|
22
|
|
|
{ |
23
|
|
|
$I->login(); |
24
|
|
|
$I->needPage(Url::to('@account')); |
25
|
|
|
$I->see('Accounts', 'h1'); |
26
|
|
|
$this->ensureICanSeeAdvancedSearchBox($I); |
27
|
|
|
$this->ensureICanSeeBulkSearchBox(); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
View Code Duplication |
private function ensureICanSeeAdvancedSearchBox(Client $I) |
|
|
|
|
31
|
|
|
{ |
32
|
|
|
$I->see('Create account', 'a'); |
33
|
|
|
$I->see('Advanced search', 'h3'); |
34
|
|
|
|
35
|
|
|
$formId = 'form-advancedsearch-account-search'; |
36
|
|
|
$this->index->containsFilters($formId, [ |
37
|
|
|
['input' => [ |
38
|
|
|
'id' => 'accountsearch-login_like', |
39
|
|
|
'placeholder' => 'Login', |
40
|
|
|
]], |
41
|
|
|
]); |
42
|
|
|
|
43
|
|
|
$I->see('Server', "//form[@id='$formId']//span"); |
44
|
|
|
$I->see('Type', "//form[@id='$formId']//span"); |
45
|
|
|
$I->see('Status', "//form[@id='$formId']//span"); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
View Code Duplication |
private function ensureICanSeeBulkSearchBox() |
|
|
|
|
49
|
|
|
{ |
50
|
|
|
$this->index->containsBulkButtons([ |
51
|
|
|
["//button[@type='button']" => 'Basic actions'], |
52
|
|
|
]); |
53
|
|
|
$this->index->containsColumns('bulk-account-search', [ |
54
|
|
|
'Account', |
55
|
|
|
'Server', |
56
|
|
|
'Status', |
57
|
|
|
'Type', |
58
|
|
|
]); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|
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.