Completed
Branch master (c22de3)
by DeGracia
02:20
created

LinesTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A info() 0 4 1
A error() 0 4 1
A success() 0 4 1
A warning() 0 4 1
A checkLine() 0 12 1
1
<?php
2
3
namespace DeGraciaMathieu\Clike\Tests;
4
5
use PHPUnit\Framework\TestCase;
6
use DeGraciaMathieu\Clike\Lines;
7
use DeGraciaMathieu\Clike\Contracts;
8
9
class LinesTest extends TestCase {
10
    
11
    /** @test */
12
    public function info()
13
    {
14
        $this->checkLine(Lines\Info::class, 'content', 'info');
15
    }
16
17
    /** @test */
18
    public function error()
19
    {
20
        $this->checkLine(Lines\Error::class, 'content', 'error');
21
    }
22
23
    /** @test */
24
    public function success()
25
    {
26
        $this->checkLine(Lines\Success::class, 'content', 'success');
27
    }
28
29
    /** @test */
30
    public function warning()
31
    {
32
        $this->checkLine(Lines\Warning::class, 'content', 'warning');
33
    }  
34
35
    protected function checkLine($line, $content, $type)
36
    {
37
        $line = new $line($content);
38
39
        $expectedArray = [
40
            'type' => $type,
41
            'content' => $content,
42
        ];
43
44
        $this->isInstanceOf(Contracts\Line::class, $line);
0 ignored issues
show
Unused Code introduced by
The call to LinesTest::isInstanceOf() has too many arguments starting with $line.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
45
        $this->assertEquals($line->read(), $expectedArray);
46
    }      
47
}
48