Completed
Push — master ( 90ca21...c1d777 )
by Dmitry
12s
created

MailboxesCest::_before()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace hipanel\modules\hosting\tests\acceptance\admin;
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\Admin;
10
11 View Code Duplication
class MailboxesCest
0 ignored issues
show
Duplication introduced by
This class 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...
12
{
13
    /**
14
     * @var IndexPage
15
     */
16
    private $index;
17
18
    public function _before(Admin $I)
19
    {
20
        $this->index = new IndexPage($I);
21
    }
22
23
    public function ensureIndexPageWorks(Admin $I)
24
    {
25
        $I->login();
26
        $I->needPage(Url::to('@mail'));
27
        $I->see('Mailboxes', 'h1');
28
        $I->seeLink('Create mailbox', Url::to('create'));
29
        $this->ensureICanSeeAdvancedSearchBox($I);
30
        $this->ensureICanSeeLegendBox();
31
        $this->ensureICanSeeBulkSearchBox();
32
    }
33
34
    private function ensureICanSeeAdvancedSearchBox(Admin $I)
35
    {
36
        $this->index->containsFilters([
37
            Input::asAdvancedSearch($I, 'E-mail'),
0 ignored issues
show
Bug introduced by
The method asAdvancedSearch() does not seem to exist on object<hipanel\tests\_su...age\Widget\Input\Input>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
38
            Select2::asAdvancedSearch($I, 'Server'),
0 ignored issues
show
Bug introduced by
The method asAdvancedSearch() does not seem to exist on object<hipanel\tests\_su...e\Widget\Input\Select2>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
39
            Select2::asAdvancedSearch($I, 'Status'),
0 ignored issues
show
Bug introduced by
The method asAdvancedSearch() does not seem to exist on object<hipanel\tests\_su...e\Widget\Input\Select2>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
40
            Select2::asAdvancedSearch($I, 'Client'),
0 ignored issues
show
Bug introduced by
The method asAdvancedSearch() does not seem to exist on object<hipanel\tests\_su...e\Widget\Input\Select2>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
41
            Select2::asAdvancedSearch($I, 'Reseller'),
0 ignored issues
show
Bug introduced by
The method asAdvancedSearch() does not seem to exist on object<hipanel\tests\_su...e\Widget\Input\Select2>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
42
            Select2::asAdvancedSearch($I, 'Type'),
0 ignored issues
show
Bug introduced by
The method asAdvancedSearch() does not seem to exist on object<hipanel\tests\_su...e\Widget\Input\Select2>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
43
        ]);
44
    }
45
46
    private function ensureICanSeeLegendBox()
47
    {
48
        $this->index->containsLegend([
49
            'Mail box',
50
            'Mail alias',
51
            'Mail box with aliases',
52
        ]);
53
    }
54
55
    private function ensureICanSeeBulkSearchBox()
56
    {
57
        $this->index->containsBulkButtons([
58
            'Enable',
59
            'Disable',
60
            'Delete',
61
        ]);
62
        $this->index->containsColumns( [
63
            'E-mail',
64
            'Type',
65
            'Forwarding',
66
            'Client',
67
            'Reseller',
68
            'Server',
69
            'Status',
70
        ]);
71
    }
72
}
73