Code Duplication    Length = 61-62 lines in 3 locations

tests/acceptance/admin/MailboxesCest.php 1 location

@@ 19-80 (lines=62) @@
16
use hipanel\tests\_support\Page\Widget\Input\Select2;
17
use hipanel\tests\_support\Step\Acceptance\Admin;
18
19
class MailboxesCest
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('@mail'));
35
        $I->see('Mailboxes', 'h1');
36
        $I->seeLink('Create mailbox', Url::to('create'));
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, 'E-mail'),
46
            Select2::asAdvancedSearch($I, 'Server'),
47
            Select2::asAdvancedSearch($I, 'Status'),
48
            Select2::asAdvancedSearch($I, 'Client'),
49
            Select2::asAdvancedSearch($I, 'Reseller'),
50
            Select2::asAdvancedSearch($I, 'Type'),
51
        ]);
52
    }
53
54
    private function ensureICanSeeLegendBox()
55
    {
56
        $this->index->containsLegend([
57
            'Mail box',
58
            'Mail alias',
59
            'Mail box with aliases',
60
        ]);
61
    }
62
63
    private function ensureICanSeeBulkSearchBox()
64
    {
65
        $this->index->containsBulkButtons([
66
            'Enable',
67
            'Disable',
68
            'Delete',
69
        ]);
70
        $this->index->containsColumns([
71
            'E-mail',
72
            'Forwarding',
73
            'Client',
74
            'Reseller',
75
            'Server',
76
            'Account',
77
            'Status',
78
        ]);
79
    }
80
}
81

tests/acceptance/client/DomainsCest.php 1 location

@@ 19-79 (lines=61) @@
16
use hipanel\tests\_support\Page\Widget\Input\Select2;
17
use hipanel\tests\_support\Step\Acceptance\Client;
18
19
class DomainsCest
20
{
21
    /**
22
     * @var IndexPage
23
     */
24
    private $index;
25
26
    public function _before(Client $I)
27
    {
28
        $this->index = new IndexPage($I);
29
    }
30
31
    public function ensureIndexPageWorks(Client $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(Client $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, 'Server'),
51
        ]);
52
    }
53
54
    private function ensureICanSeeLegendBox()
55
    {
56
        $this->index->containsLegend([
57
            'Domain',
58
            'DNS records',
59
            'Alias',
60
            'Name server',
61
            'Complex domain',
62
        ]);
63
    }
64
65
    private function ensureICanSeeBulkSearchBox()
66
    {
67
        $this->index->containsBulkButtons([
68
            'Delete',
69
        ]);
70
        $this->index->containsColumns([
71
            'Domain name',
72
            'Account',
73
            'Server',
74
            'Status',
75
            'IP',
76
            'Service',
77
        ]);
78
    }
79
}
80

tests/acceptance/seller/MailboxesCest.php 1 location

@@ 19-80 (lines=62) @@
16
use hipanel\tests\_support\Page\Widget\Input\Select2;
17
use hipanel\tests\_support\Step\Acceptance\Seller;
18
19
class MailboxesCest
20
{
21
    /**
22
     * @var IndexPage
23
     */
24
    private $index;
25
26
    public function _before(Seller $I)
27
    {
28
        $this->index = new IndexPage($I);
29
    }
30
31
    public function ensureIndexPageWorks(Seller $I)
32
    {
33
        $I->login();
34
        $I->needPage(Url::to('@mail'));
35
        $I->see('Mailboxes', 'h1');
36
        $I->seeLink('Create mailbox', Url::to('create'));
37
        $this->ensureICanSeeAdvancedSearchBox($I);
38
        $this->ensureICanSeeLegendBox();
39
        $this->ensureICanSeeBulkSearchBox();
40
    }
41
42
    private function ensureICanSeeAdvancedSearchBox(Seller $I)
43
    {
44
        $this->index->containsFilters([
45
            Input::asAdvancedSearch($I, 'E-mail'),
46
            Select2::asAdvancedSearch($I, 'Server'),
47
            Select2::asAdvancedSearch($I, 'Status'),
48
            Select2::asAdvancedSearch($I, 'Client'),
49
            Select2::asAdvancedSearch($I, 'Reseller'),
50
            Select2::asAdvancedSearch($I, 'Type'),
51
        ]);
52
    }
53
54
    private function ensureICanSeeLegendBox()
55
    {
56
        $this->index->containsLegend([
57
            'Mail box',
58
            'Mail alias',
59
            'Mail box with aliases',
60
        ]);
61
    }
62
63
    private function ensureICanSeeBulkSearchBox()
64
    {
65
        $this->index->containsBulkButtons([
66
            'Enable',
67
            'Disable',
68
            'Delete',
69
        ]);
70
        $this->index->containsColumns([
71
            'E-mail',
72
            'Forwarding',
73
            'Client',
74
            'Reseller',
75
            'Server',
76
            'Account',
77
            'Status',
78
        ]);
79
    }
80
}
81