4
4
5
5
use Fireworkweb \Gates \Middlewares \Gate ;
6
6
use Fireworkweb \Gates \Tests \Policies \PolicyWithGates ;
7
- use Illuminate \Support \Facades \Artisan ;
8
- use Illuminate \Support \Str ;
9
7
10
8
class CommandTest extends TestCase
11
9
{
@@ -23,14 +21,11 @@ public function it_can_see_all_routes_with_gate()
23
21
return 'yay ' ;
24
22
})->name ('policy.accept ' )->middleware (Gate::class);
25
23
26
- $ exitCode = Artisan:: call ('gates:routes-without-gate ' , [
24
+ $ this -> artisan ('gates:routes-without-gate ' , [
27
25
'middleware ' => Gate::class,
28
- ]);
29
-
30
- $ output = Artisan::output ();
31
-
32
- $ this ->assertSame (0 , $ exitCode );
33
- $ this ->assertTrue (Str::contains ($ output , 'Great job, no routes without gate. :) ' ));
26
+ ])
27
+ ->expectsOutput ('Great job, no routes without gate. :) ' )
28
+ ->assertExitCode (0 );
34
29
}
35
30
36
31
/** @test */
@@ -40,14 +35,10 @@ public function it_can_see_a_route_without_gate()
40
35
return 'yay ' ;
41
36
})->name ('something.index ' )->middleware (Gate::class);
42
37
43
- $ exitCode = Artisan:: call ('gates:routes-without-gate ' , [
38
+ $ this -> artisan ('gates:routes-without-gate ' , [
44
39
'middleware ' => Gate::class,
45
- ]);
46
-
47
- $ output = Artisan::output ();
48
-
49
- $ this ->assertSame (1 , $ exitCode );
50
- $ this ->assertTrue (Str::contains ($ output , 'You got routes without gate, see list below: ' ));
51
- $ this ->assertTrue (Str::contains ($ output , 'something.index ' ));
40
+ ])
41
+ ->expectsOutput ('You got routes without gate, see list below: ' )
42
+ ->assertExitCode (1 );
52
43
}
53
44
}
0 commit comments