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

tests/acceptance/client/DatabasesCest.php (2 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\client;
4
5
use hipanel\helpers\Url;
6
use hipanel\tests\_support\Page\IndexPage;
7
use hipanel\tests\_support\Step\Acceptance\Client;
8
9
class DatabasesCest
10
{
11
    /**
12
     * @var IndexPage
13
     */
14
    private $index;
15
16
    public function _before(Client $I)
17
    {
18
        $this->index = new IndexPage($I);
19
    }
20
21 View Code Duplication
    public function ensureIndexPageWorks(Client $I)
0 ignored issues
show
This method 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...
22
    {
23
        $I->login();
24
        $I->needPage(Url::to('@db'));
25
        $I->see('Databases', 'h1');
26
        $this->ensureICanSeeAdvancedSearchBox($I);
27
        $this->ensureICanSeeBulkSearchBox();
28
    }
29
30
    private function ensureICanSeeAdvancedSearchBox(Client $I)
31
    {
32
        $I->seeLink('Create DB', Url::to('create'));
33
        $I->see('Advanced search', 'h3');
34
35
        $formId = 'form-advancedsearch-db-search';
36
        $this->index->containsFilters($formId, [
37
            ['input' => [
38
                'id' => 'dbsearch-name',
39
                'placeholder' => 'DB name',
40
            ]],
41
            ['input' => [
42
                'id' => 'dbsearch-description',
43
                'placeholder' => 'Description',
44
            ]],
45
            ['input' => [
46
                'placeholder' => 'Status',
47
            ]],
48
        ]);
49
50
        $I->see('Server', "//form[@id='$formId']//span");
51
    }
52
53 View Code Duplication
    private function ensureICanSeeBulkSearchBox()
0 ignored issues
show
This method 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...
54
    {
55
        $this->index->containsBulkButtons([
56
            ["//button[@type='submit']" => 'Delete'],
57
        ]);
58
        $this->index->containsColumns('bulk-db-search', [
59
            'DB name',
60
            'Account',
61
            'Server',
62
            'Description',
63
            'Status',
64
        ]);
65
    }
66
}
67