Completed
Push — master ( 910aee...a67276 )
by Dmitry
03:24
created

Index   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 50
Duplicated Lines 36 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 1
dl 18
loc 50
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A ensurePageWorks() 0 11 1
A ensureThatICanNavigateToCreateTicketPage() 0 15 1
A hasLinkToTicket() 9 9 1
A hasntLinkToTicket() 9 9 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\ticket\tests\_support\Page\ticket;
4
5
use hipanel\tests\_support\Page\Authenticated;
6
use yii\helpers\Url;
7
8
/**
9
 * Class Index
10
 *
11
 * @author Dmytro Naumenko <[email protected]>
12
 */
13
class Index extends Authenticated
14
{
15
    public function ensurePageWorks()
16
    {
17
        $I = $this->tester;
18
        $I->amOnPage(Url::to(['@ticket']));
19
20
        $I->performOnContent(\Codeception\Util\ActionSequence::build()
21
            ->see('Create ticket')
22
        );
23
24
        return $this;
25
    }
26
27
    public function ensureThatICanNavigateToCreateTicketPage()
28
    {
29
        $I = $this->tester;
30
31
        $I->amOnPage(Url::to(['@ticket']));
32
33
        $I->click('Create ticket', '.content-wrapper');
34
35
        $I->waitForElement('#create-thread-form');
36
        $I->see('Topics');
37
        $I->see('Subject');
38
        $I->see('Create ticket', 'button');
39
40
        return $this;
41
    }
42
43 View Code Duplication
    public function hasLinkToTicket($id)
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...
44
    {
45
        $I = $this->tester;
46
47
        $I->amOnPage(Url::to(['@ticket']));
48
        $I->seeElement('tr', ['data-key' => $id]);
49
50
        return $this;
51
    }
52
53 View Code Duplication
    public function hasntLinkToTicket($id)
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...
54
    {
55
        $I = $this->tester;
56
57
        $I->amOnPage(Url::to(['@ticket']));
58
        $I->dontSeeElement('tr', ['data-key' => $id]);
59
60
        return $this;
61
    }
62
}
63