diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 5c487cb..b1dbc88 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -10,7 +10,7 @@ jobs: matrix: os: [ubuntu-latest, windows-latest] php: [7.3, 7.4] - laravel: [5.8.*, 6.*, 7.*] + laravel: [6.*, 7.*] dependency-version: [prefer-lowest, prefer-stable] name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }} diff --git a/tests/CommandTest.php b/tests/CommandTest.php index 2112bda..1bdc044 100644 --- a/tests/CommandTest.php +++ b/tests/CommandTest.php @@ -4,8 +4,6 @@ use Fireworkweb\Gates\Middlewares\Gate; use Fireworkweb\Gates\Tests\Policies\PolicyWithGates; -use Illuminate\Support\Facades\Artisan; -use Illuminate\Support\Str; class CommandTest extends TestCase { @@ -23,14 +21,11 @@ public function it_can_see_all_routes_with_gate() return 'yay'; })->name('policy.accept')->middleware(Gate::class); - $exitCode = Artisan::call('gates:routes-without-gate', [ + $this->artisan('gates:routes-without-gate', [ 'middleware' => Gate::class, - ]); - - $output = Artisan::output(); - - $this->assertSame(0, $exitCode); - $this->assertTrue(Str::contains($output, 'Great job, no routes without gate. :)')); + ]) + ->expectsOutput('Great job, no routes without gate. :)') + ->assertExitCode(0); } /** @test */ @@ -40,14 +35,10 @@ public function it_can_see_a_route_without_gate() return 'yay'; })->name('something.index')->middleware(Gate::class); - $exitCode = Artisan::call('gates:routes-without-gate', [ + $this->artisan('gates:routes-without-gate', [ 'middleware' => Gate::class, - ]); - - $output = Artisan::output(); - - $this->assertSame(1, $exitCode); - $this->assertTrue(Str::contains($output, 'You got routes without gate, see list below:')); - $this->assertTrue(Str::contains($output, 'something.index')); + ]) + ->expectsOutput('You got routes without gate, see list below:') + ->assertExitCode(1); } }