File tree Expand file tree Collapse file tree
tests/Integration/Testing Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -532,11 +532,11 @@ protected function verifyExpectations()
532532 $ this ->test ->fail ('Output does not contain " ' .Arr::first ($ this ->test ->expectedOutputSubstrings ).'". ' );
533533 }
534534
535- if ($ output = array_search (true , $ this ->test ->unexpectedOutput )) {
535+ if (( $ output = array_search (true , $ this ->test ->unexpectedOutput )) !== false ) {
536536 $ this ->test ->fail ('Output " ' .$ output .'" was printed. ' );
537537 }
538538
539- if ($ output = array_search (true , $ this ->test ->unexpectedOutputSubstrings )) {
539+ if (( $ output = array_search (true , $ this ->test ->unexpectedOutputSubstrings )) !== false ) {
540540 $ this ->test ->fail ('Output " ' .$ output .'" was printed. ' );
541541 }
542542 }
Original file line number Diff line number Diff line change @@ -56,6 +56,10 @@ protected function setUp(): void
5656 $ this ->line ('My name is Taylor Otwell ' );
5757 });
5858
59+ Artisan::command ('zero ' , function () {
60+ $ this ->line ('0 ' );
61+ });
62+
5963 Artisan::command ('new-england ' , function () {
6064 $ this ->line ('The region of New England consists of the following states: ' );
6165 $ this ->info ('Connecticut ' );
@@ -125,6 +129,26 @@ public function test_console_command_that_fails_from_unexpected_output_substring
125129 ->assertExitCode (0 );
126130 }
127131
132+ public function test_console_command_that_fails_from_zero_as_unexpected_output ()
133+ {
134+ $ this ->expectException (AssertionFailedError::class);
135+ $ this ->expectExceptionMessage ('Output "0" was printed. ' );
136+
137+ $ this ->artisan ('zero ' )
138+ ->doesntExpectOutput ('0 ' )
139+ ->assertExitCode (0 );
140+ }
141+
142+ public function test_console_command_that_fails_from_zero_as_unexpected_output_substring ()
143+ {
144+ $ this ->expectException (AssertionFailedError::class);
145+ $ this ->expectExceptionMessage ('Output "0" was printed. ' );
146+
147+ $ this ->artisan ('zero ' )
148+ ->doesntExpectOutputToContain ('0 ' )
149+ ->assertExitCode (0 );
150+ }
151+
128152 public function test_console_command_that_fails_from_missing_output ()
129153 {
130154 $ this ->expectException (AssertionFailedError::class);
You can’t perform that action at this time.
0 commit comments