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

tests/acceptance/admin/IPAddressesCest.php (4 issues)

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\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 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(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('@ip'));
27
        $I->see('IP addresses', 'h1');
28
        $this->ensureICanSeeAdvancedSearchBox($I);
29
        $this->ensureICanSeeLegendBox();
30
        $this->ensureICanSeeBulkSearchBox();
31
    }
32
33
    private function ensureICanSeeAdvancedSearchBox(Admin $I)
34
    {
35
        $this->index->containsFilters([
36
            Input::asAdvancedSearch($I, 'IP'),
0 ignored issues
show
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...
37
            Select2::asAdvancedSearch($I, 'Servers'),
0 ignored issues
show
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...
38
            Select2::asAdvancedSearch($I, 'Tags'),
0 ignored issues
show
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
        ]);
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
            'Note',
58
            'Tags',
59
            'Counters',
60
            'Links',
61
        ]);
62
    }
63
}
64