Completed
Push — master ( 965752...27c0a7 )
by Dmitry
01:15
created

tests/acceptance/client/IPAddressesCest.php (1 issue)

Upgrade to new PHP Analysis Engine

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\Page\Widget\Input\Input;
8
use hipanel\tests\_support\Page\Widget\Input\Select2;
9
use hipanel\tests\_support\Step\Acceptance\Client;
10
11 View Code Duplication
class IPAddressesCest
0 ignored issues
show
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(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