Passed
Push — master ( 21c505...12ca40 )
by Sebastian
02:34
created

NullIOTest   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 84
Duplicated Lines 17.86 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 8
lcom 0
cbo 1
dl 15
loc 84
c 1
b 0
f 1
rs 10

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 sebastianfeldmann\CaptainHook\Console\IO;
4
5
class NullIOTest extends \PHPUnit_Framework_TestCase
6
{
7
    /**
8
     * Tests NullIO::isInteractive
9
     */
10
    public function testIsInteractive()
11
    {
12
        $io = new NullIO();
13
        $this->assertFalse($io->isInteractive());
14
    }
15
16
    /**
17
     * Tests NullIO::isDebug
18
     */
19
    public function testIsDebug()
20
    {
21
        $io = new NullIO();
22
        $this->assertFalse($io->isDebug());
23
    }
24
25
    /**
26
     * Tests NullIO::isVerbose
27
     */
28
    public function testIsVerbose()
29
    {
30
        $io = new NullIO();
31
        $this->assertFalse($io->isVerbose());
32
    }
33
34
    /**
35
     * Tests NullIO::isVeryVerbose
36
     */
37
    public function testIsVeryVerbose()
38
    {
39
        $io = new NullIO();
40
        $this->assertFalse($io->isVeryVerbose());
41
    }
42
43
    /**
44
     * Tests NullIO::writeError
45
     */
46
    public function testWriteError()
47
    {
48
        $io = new NullIO();
49
        $io->writeError('foo');
50
    }
51
52
    /**
53
     * Tests NullIO::ask
54
     */
55
    public function testAsk()
56
    {
57
        $io = new NullIO();
58
        $this->assertEquals('bar', $io->ask('foo', 'bar'));
59
    }
60
61
    /**
62
     * Tests NullIO::askConfirmation
63
     */
64
    public function testAskConfirmation()
65
    {
66
        $io = new NullIO();
67
        $this->assertEquals(true, $io->askConfirmation('foo', true));
68
    }
69
70
    /**
71
     * Tests NullIO::askAbdValidate
72
     */
73
    public function testAskAndValidate()
74
    {
75
        $io = new NullIO();
76
        $this->assertEquals(
77
            true,
78
            $io->askAndValidate(
79
                'foo',
80
                function() {
81
                    return true;
82
                },
83
                false,
84
                true
85
            )
86
        );
87
    }
88
}
89