Code Duplication    Length = 45-51 lines in 4 locations

tests/acceptance/client/AccountsCest.php 1 location

@@ 11-55 (lines=45) @@
8
use hipanel\tests\_support\Page\Widget\Input\Select2;
9
use hipanel\tests\_support\Step\Acceptance\Client;
10
11
class AccountsCest
12
{
13
    /**
14
     * @var IndexPage
15
     */
16
    private $index;
17
18
    public function _before(Client $I)
19
    {
20
        $this->index = new IndexPage($I);
21
    }
22
23
    public function ensureIndexPageWorks(Client $I)
24
    {
25
        $I->login();
26
        $I->needPage(Url::to('@account'));
27
        $I->see('Accounts', 'h1');
28
        $I->see('Create account', 'a');
29
        $this->ensureICanSeeAdvancedSearchBox();
30
        $this->ensureICanSeeBulkSearchBox();
31
    }
32
33
    private function ensureICanSeeAdvancedSearchBox()
34
    {
35
        $this->index->containsFilters([
36
            new Input('Login'),
37
            new Select2('Server'),
38
            new Select2('Type'),
39
            new Select2('Status'),
40
        ]);
41
    }
42
43
    private function ensureICanSeeBulkSearchBox()
44
    {
45
        $this->index->containsBulkButtons([
46
            'Basic actions',
47
        ]);
48
        $this->index->containsColumns([
49
            'Account',
50
            'Server',
51
            'Status',
52
            'Type',
53
        ]);
54
    }
55
}
56

tests/acceptance/client/DatabasesCest.php 1 location

@@ 11-56 (lines=46) @@
8
use hipanel\tests\_support\Page\Widget\Input\Select2;
9
use hipanel\tests\_support\Step\Acceptance\Client;
10
11
class DatabasesCest
12
{
13
    /**
14
     * @var IndexPage
15
     */
16
    private $index;
17
18
    public function _before(Client $I)
19
    {
20
        $this->index = new IndexPage($I);
21
    }
22
23
    public function ensureIndexPageWorks(Client $I)
24
    {
25
        $I->login();
26
        $I->needPage(Url::to('@db'));
27
        $I->see('Databases', 'h1');
28
        $I->seeLink('Create DB', Url::to('create'));
29
        $this->ensureICanSeeAdvancedSearchBox();
30
        $this->ensureICanSeeBulkSearchBox();
31
    }
32
33
    private function ensureICanSeeAdvancedSearchBox()
34
    {
35
        $this->index->containsFilters([
36
            new Input('DB name'),
37
            new Input('Description'),
38
            new Input('Status'),
39
            new Select2('Server')
40
        ]);
41
    }
42
43
    private function ensureICanSeeBulkSearchBox()
44
    {
45
        $this->index->containsBulkButtons([
46
            'Delete',
47
        ]);
48
        $this->index->containsColumns([
49
            'DB name',
50
            'Account',
51
            'Server',
52
            'Description',
53
            'Status',
54
        ]);
55
    }
56
}
57

tests/acceptance/client/IPAddressesCest.php 1 location

@@ 11-61 (lines=51) @@
8
use hipanel\tests\_support\Page\Widget\Input\Select2;
9
use hipanel\tests\_support\Step\Acceptance\Client;
10
11
class IPAddressesCest
12
{
13
    /**
14
     * @var IndexPage
15
     */
16
    private $index;
17
18
    public function _before(Client $I)
19
    {
20
        $this->index = new IndexPage($I);
21
    }
22
23
    public function ensureIndexPageWorks(Client $I)
24
    {
25
        $I->login();
26
        $I->needPage(Url::to('@ip'));
27
        $I->see('IP addresses', 'h1');
28
        $this->ensureICanSeeAdvancedSearchBox();
29
        $this->ensureICanSeeLegendBox();
30
        $this->ensureICanSeeBulkSearchBox();
31
    }
32
33
    private function ensureICanSeeAdvancedSearchBox()
34
    {
35
        $this->index->containsFilters([
36
            new Input('IP'),
37
            new Input('Tags'),
38
            new Select2('Servers'),
39
        ]);
40
    }
41
42
    private function ensureICanSeeLegendBox()
43
    {
44
        $this->index->containsLegend([
45
            'Shared',
46
            'Free',
47
            'Dedicated',
48
            'System',
49
            'Blocked',
50
        ]);
51
    }
52
53
    private function ensureICanSeeBulkSearchBox()
54
    {
55
        $this->index->containsColumns([
56
            'IP',
57
            'Counters',
58
            'Links',
59
        ]);
60
    }
61
}
62

tests/acceptance/seller/IPAddressesCest.php 1 location

@@ 11-61 (lines=51) @@
8
use hipanel\tests\_support\Page\Widget\Input\Select2;
9
use hipanel\tests\_support\Step\Acceptance\Seller;
10
11
class IPAddressesCest
12
{
13
    /**
14
     * @var IndexPage
15
     */
16
    private $index;
17
18
    public function _before(Seller $I)
19
    {
20
        $this->index = new IndexPage($I);
21
    }
22
23
    public function ensureIndexPageWorks(Seller $I)
24
    {
25
        $I->login();
26
        $I->needPage(Url::to('@ip'));
27
        $I->see('IP addresses', 'h1');
28
        $this->ensureICanSeeAdvancedSearchBox();
29
        $this->ensureICanSeeLegendBox();
30
        $this->ensureICanSeeBulkSearchBox();
31
    }
32
33
    private function ensureICanSeeAdvancedSearchBox()
34
    {
35
        $this->index->containsFilters([
36
            new Input('IP'),
37
            new Select2('Servers'),
38
            new Input('Tags'),
39
        ]);
40
    }
41
42
    private function ensureICanSeeLegendBox()
43
    {
44
        $this->index->containsLegend([
45
            'Shared',
46
            'Free',
47
            'Dedicated',
48
            'System',
49
            'Blocked',
50
        ]);
51
    }
52
53
    private function ensureICanSeeBulkSearchBox()
54
    {
55
        $this->index->containsColumns([
56
            'IP',
57
            'Counters',
58
            'Links',
59
        ]);
60
    }
61
}
62