BillCest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 20.45 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 5
dl 9
loc 44
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A _before() 0 4 1
A ensureIndexPageWorks() 9 9 1
A ensureICanSeeAdvancedSearchBox() 0 10 1
A ensureICanSeeBulkBillSearchBox() 0 10 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
 * Finance module for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-finance
6
 * @package   hipanel-module-finance
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\finance\tests\acceptance\client;
12
13
use hipanel\helpers\Url;
14
use hipanel\tests\_support\Page\IndexPage;
15
use hipanel\tests\_support\Page\Widget\Input\Input;
16
use hipanel\tests\_support\Page\Widget\Input\Select2;
17
use hipanel\tests\_support\Step\Acceptance\Client;
18
19
class BillCest
20
{
21
    /**
22
     * @var IndexPage
23
     */
24
    private $index;
25
26
    public function _before(Client $I)
27
    {
28
        $this->index = new IndexPage($I);
29
    }
30
31 View Code Duplication
    public function ensureIndexPageWorks(Client $I)
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...
32
    {
33
        $I->login();
34
        $I->needPage(Url::to('@bill/index'));
35
        $I->see('Bills', 'h1');
36
        $I->seeLink('Recharge account', Url::to('@pay/deposit'));
37
        $this->ensureICanSeeAdvancedSearchBox($I);
38
        $this->ensureICanSeeBulkBillSearchBox();
39
    }
40
41
    private function ensureICanSeeAdvancedSearchBox(Client $I)
42
    {
43
        $this->index->containsFilters([
44
            Select2::asAdvancedSearch($I, 'Currency'),
45
            Select2::asAdvancedSearch($I, 'Type'),
46
            Input::asAdvancedSearch($I, 'Servers'),
47
            Input::asAdvancedSearch($I, 'Description'),
48
            Select2::asAdvancedSearch($I, 'Tariff'),
49
        ]);
50
    }
51
52
    private function ensureICanSeeBulkBillSearchBox()
53
    {
54
        $this->index->containsColumns([
55
            'Time',
56
            'Sum',
57
            'Balance',
58
            'Type',
59
            'Description',
60
        ]);
61
    }
62
}
63