These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
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 MailboxesCest |
||
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) |
|
0 ignored issues
–
show
|
|||
22 | { |
||
23 | $I->login(); |
||
24 | $I->needPage(Url::to('@mail')); |
||
25 | $I->see('Mailboxes', 'h1'); |
||
26 | $this->ensureICanSeeAdvancedSearchBox($I); |
||
27 | $this->ensureICanSeeLegendBox($I); |
||
28 | $this->ensureICanSeeBulkSearchBox(); |
||
29 | } |
||
30 | |||
31 | private function ensureICanSeeAdvancedSearchBox(Client $I) |
||
32 | { |
||
33 | $I->seeLink('Create mailbox', Url::to('create')); |
||
34 | $I->see('Advanced search', 'h3'); |
||
35 | |||
36 | $formId = 'form-advancedsearch-mail-search'; |
||
37 | $this->index->containsFilters($formId, [ |
||
38 | ['input' => [ |
||
39 | 'id' => 'mailsearch-mail_like', |
||
40 | 'placeholder' => 'E-mail', |
||
41 | ]], |
||
42 | ]); |
||
43 | |||
44 | $I->see('Server', "//form[@id='$formId']//span"); |
||
45 | $I->see('Status', "//form[@id='$formId']//span"); |
||
46 | $I->see('Type', "//form[@id='$formId']//span"); |
||
47 | } |
||
48 | |||
49 | View Code Duplication | private function ensureICanSeeLegendBox(Client $I) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
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.
Loading history...
|
|||
50 | { |
||
51 | $I->see('Legend', 'h3'); |
||
52 | |||
53 | $legend = [ |
||
54 | 'Mail box', |
||
55 | 'Mail alias', |
||
56 | 'Mail box with aliases', |
||
57 | ]; |
||
58 | foreach ($legend as $text) { |
||
59 | $I->see($text, '//ul/li'); |
||
60 | } |
||
61 | } |
||
62 | |||
63 | private function ensureICanSeeBulkSearchBox() |
||
64 | { |
||
65 | $this->index->containsBulkButtons([ |
||
66 | ["//button[@type='submit']" => 'Enable'], |
||
67 | ["//button[@type='submit']" => 'Disable'], |
||
68 | ["//button[@type='submit']" => 'Delete'], |
||
69 | ]); |
||
70 | $this->index->containsColumns('bulk-mail-search', [ |
||
71 | 'E-mail', |
||
72 | 'Type', |
||
73 | 'Forwarding', |
||
74 | 'Server', |
||
75 | 'Status', |
||
76 | ]); |
||
77 | } |
||
78 | } |
||
79 |
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.