Completed
Push — master ( b21958...b5070f )
by Dmitry
33s
created

AccountsCest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 71.15 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 37
loc 52
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A _before() 0 4 1
A ensureIndexPageWorks() 8 8 1
A ensureICanSeeAdvancedSearchBox() 17 17 1
A ensureICanSeeBulkSearchBox() 12 12 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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 AccountsCest
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
Duplication introduced by pkolomiy
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('@account'));
25
        $I->see('Accounts', 'h1');
26
        $this->ensureICanSeeAdvancedSearchBox($I);
27
        $this->ensureICanSeeBulkSearchBox();
28
    }
29
30 View Code Duplication
    private function ensureICanSeeAdvancedSearchBox(Client $I)
0 ignored issues
show
Duplication introduced by pkolomiy
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...
31
    {
32
        $I->see('Create account', 'a');
33
        $I->see('Advanced search', 'h3');
34
35
        $formId = 'form-advancedsearch-account-search';
36
        $this->index->containsFilters($formId, [
37
            ['input' => [
38
                'id' => 'accountsearch-login_like',
39
                'placeholder' => 'Login',
40
            ]],
41
        ]);
42
43
        $I->see('Server', "//form[@id='$formId']//span");
44
        $I->see('Type', "//form[@id='$formId']//span");
45
        $I->see('Status', "//form[@id='$formId']//span");
46
    }
47
48 View Code Duplication
    private function ensureICanSeeBulkSearchBox()
0 ignored issues
show
Duplication introduced by pkolomiy
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...
49
    {
50
        $this->index->containsBulkButtons([
51
            ["//button[@type='button']" => 'Basic actions'],
52
        ]);
53
        $this->index->containsColumns('bulk-account-search', [
54
            'Account',
55
            'Server',
56
            'Status',
57
            'Type',
58
        ]);
59
    }
60
}
61