NullIOTest   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 8
c 0
b 0
f 0
lcom 2
cbo 2
dl 0
loc 60
ccs 0
cts 41
cp 0
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A testIsInteractive() 0 6 1
A testIsVerbose() 0 6 1
A testIsVeryVerbose() 0 6 1
A testIsDebug() 0 6 1
A testIsDecorated() 0 6 1
A testAsk() 0 6 1
A testAskConfirmation() 0 6 1
A testAskAndValidate() 0 8 1
1
<?php
2
3
/*
4
 * This file is part of the Yosymfony\Spress.
5
 *
6
 * (c) YoSymfony <http://github.com/yosymfony>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Yosymfony\Spress\Core\Tests\IO;
13
14
use PHPUnit\Framework\TestCase;
15
use Yosymfony\Spress\Core\IO\NullIO;
16
17
class NullIOTest extends TestCase
18
{
19
    public function testIsInteractive()
20
    {
21
        $nullIO = new NullIO();
22
23
        $this->assertFalse($nullIO->isInteractive());
24
    }
25
26
    public function testIsVerbose()
27
    {
28
        $nullIO = new NullIO();
29
30
        $this->assertFalse($nullIO->isVerbose());
31
    }
32
33
    public function testIsVeryVerbose()
34
    {
35
        $nullIO = new NullIO();
36
37
        $this->assertFalse($nullIO->isVeryVerbose());
38
    }
39
40
    public function testIsDebug()
41
    {
42
        $nullIO = new NullIO();
43
44
        $this->assertFalse($nullIO->isDebug());
45
    }
46
47
    public function testIsDecorated()
48
    {
49
        $nullIO = new NullIO();
50
51
        $this->assertFalse($nullIO->isDecorated());
52
    }
53
54
    public function testAsk()
55
    {
56
        $nullIO = new NullIO();
57
58
        $this->assertEquals('default', $nullIO->ask('Is valid?', 'default'));
59
    }
60
61
    public function testAskConfirmation()
62
    {
63
        $nullIO = new NullIO();
64
65
        $this->assertEquals('default', $nullIO->askConfirmation('Is valid?', 'default'));
0 ignored issues
show
Documentation introduced by
'default' is of type string, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
66
    }
67
68
    public function testAskAndValidate()
69
    {
70
        $nullIO = new NullIO();
71
72
        $this->assertEquals('default', $nullIO->askAndValidate('Is valid?', function () {
73
            return 'validator';
74
        }, 10, 'default'));
0 ignored issues
show
Documentation introduced by
10 is of type integer, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
75
    }
76
}
77