@@ -42,13 +42,32 @@ public function testCanDisplayHelpText()
42
42
$ app = new App (new Cli (), self ::calculator (), $ composer , $ output );
43
43
44
44
//act
45
- $ app ->run (['libyear ' , '--help ' ]);
45
+ $ result = $ app ->run (['libyear ' , '--help ' ]);
46
46
47
47
//assert
48
48
fseek ($ output , 0 );
49
49
$ console = stream_get_contents ($ output );
50
50
$ this ->assertStringContainsString ('OPTIONS ' , $ console );
51
51
$ this ->assertStringContainsString ('ARGUMENTS ' , $ console );
52
+ $ this ->assertTrue ($ result );
53
+ }
54
+
55
+ public function testInvalidOptionDisplaysHelpText ()
56
+ {
57
+ //arrange
58
+ $ composer = Mockery::mock (ComposerFile::class);
59
+ $ output = fopen ('php://memory ' , 'a+ ' );
60
+ $ app = new App (new Cli (), self ::calculator (), $ composer , $ output );
61
+
62
+ //act
63
+ $ result = $ app ->run (['libyear ' , '-x ' ]);
64
+
65
+ //assert
66
+ fseek ($ output , 0 );
67
+ $ console = stream_get_contents ($ output );
68
+ $ this ->assertStringContainsString ('OPTIONS ' , $ console );
69
+ $ this ->assertStringContainsString ('ARGUMENTS ' , $ console );
70
+ $ this ->assertFalse ($ result );
52
71
}
53
72
54
73
public function testShowsAllDependenciesByDefault ()
@@ -59,13 +78,14 @@ public function testShowsAllDependenciesByDefault()
59
78
$ app = new App (new Cli (), self ::calculator (), $ composer , $ output );
60
79
61
80
//act
62
- $ app ->run (['libyear ' , '. ' ]);
81
+ $ result = $ app ->run (['libyear ' , '. ' ]);
63
82
64
83
//assert
65
84
fseek ($ output , 0 );
66
85
$ console = stream_get_contents ($ output );
67
86
$ this ->assertStringContainsString ('Test 1 ' , $ console );
68
87
$ this ->assertStringContainsString ('Test 2 ' , $ console );
88
+ $ this ->assertTrue ($ result );
69
89
}
70
90
71
91
public function testQuietModeOnlyShowsOutdated ()
0 commit comments