Completed
Push — master ( 0daa94...bd0347 )
by Dmitry
06:30
created

BillCest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 55
Duplicated Lines 29.09 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A _before() 0 4 1
A ensureIndexPageWorks() 0 12 1
A ensureICanSeeAdvancedSearchBox() 0 12 1
A ensureICanSeeBulkBillSearchBox() 16 16 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\finance\tests\acceptance\seller;
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\Seller;
10
11
class BillCest
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('@bill'));
27
        $I->see('Bills', 'h1');
28
        $I->seeLink('Recharge account', Url::to('@pay/deposit'));
29
        $I->seeLink('Add payment', Url::to('@bill/create'));
30
        $I->seeLink('Currency exchange', Url::to('@bill/create-exchange'));
31
        $I->seeLink('Import payments', Url::to('@bill/import'));
32
        $this->ensureICanSeeAdvancedSearchBox();
33
        $this->ensureICanSeeBulkBillSearchBox();
34
    }
35
36
    private function ensureICanSeeAdvancedSearchBox()
37
    {
38
        $this->index->containsFilters([
39
            new Select2('Client'),
40
            new Input('Currency'),
41
            new Input('Type'),
42
            new Input('Servers'),
43
            new Input('Description'),
44
            new Select2('Tariff'),
45
            new Select2('Reseller'),
46
        ]);
47
    }
48
49 View Code Duplication
    private function ensureICanSeeBulkBillSearchBox()
0 ignored issues
show
Duplication introduced by
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...
50
    {
51
        $this->index->containsBulkButtons([
52
            'Copy',
53
            'Update',
54
            'Delete',
55
        ]);
56
        $this->index->containsColumns([
57
            'Client',
58
            'Time',
59
            'Sum',
60
            'Balance',
61
            'Type',
62
            'Description',
63
        ]);
64
    }
65
}
66