Completed
Push — master ( 56185f...c80cc1 )
by Scott
13s
created

PhpcsTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 58
Duplicated Lines 91.38 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 53
loc 58
rs 10
wmc 2
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testSuccessfulOutput() 10 10 1
B testFailedOutput() 43 43 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
namespace exussum12\CoverageChecker\tests\Outputs;
3
4
use exussum12\CoverageChecker\Outputs\Phpcs;
5
use exussum12\CoverageChecker\tests\Output;
6
7
class PhpcsTest extends Output
8
{
9 View Code Duplication
    public function testSuccessfulOutput()
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...
10
    {
11
        $output = new Phpcs();
12
        ob_start();
13
        $output->output($this->getAllValid(), 100, 100);
14
        $report = ob_get_clean();
15
16
        $expected = '{"files":[],"totals":{"errors":0,"fixable":0,"warnings":0}}';
17
        $this->assertJsonStringEqualsJsonString($expected, $report);
18
    }
19
20 View Code Duplication
   public function testFailedOutput()
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...
21
   {
22
        $output = new Phpcs();
23
        ob_start();
24
        $output->output($this->getFailing(), 80, 100);
25
        $report = ob_get_clean();
26
        $expected = '{
27
            "files":
28
                {"file1.php":
29
                    {"messages":[
30
                        {
31
                            "message":"Line 10 has an error",
32
                            "line": 10,
33
                            "type":"ERROR",
34
                            "column":1,
35
                            "fixable":"false",
36
                            "severity":1,
37
                            "source":"diffFilter"
38
                        }
39
                      ],
40
                      "errors":1,
41
                      "warnings":0
42
                    }
43
                ,
44
                "file2.php":
45
                    {"messages":[
46
                        {
47
                            "message":"Line 15 has another error",
48
                            "line": 15,
49
                            "type":"ERROR",
50
                            "column":1,
51
                            "fixable":"false",
52
                            "severity":1,
53
                            "source":"diffFilter"
54
                        }
55
                      ],
56
                      "errors":1,
57
                      "warnings":0
58
                    }
59
                },
60
            "totals":{"errors":2,"fixable":0,"warnings":0}}';
61
        $this->assertJsonStringEqualsJsonString($expected, $report);
62
   }
63
64
}
65