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')); |
|
|
|
|
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')); |
|
|
|
|
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|
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: