mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-26 11:14:06 +00:00
161 - Testing That Middleware Is Applied
This commit is contained in:
@@ -6,6 +6,7 @@ use App\User;
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use App\Http\Middleware\ForceStripeAccount;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
@@ -55,4 +56,27 @@ class ForceStripeAccountTest extends TestCase
|
||||
$this->assertTrue($next->called);
|
||||
$this->assertSame($response, $request);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function middleware_is_applied_to_all_backstage_routes()
|
||||
{
|
||||
$routes = [
|
||||
'backstage.concerts.index',
|
||||
'backstage.concerts.new',
|
||||
'backstage.concerts.store',
|
||||
'backstage.concerts.edit',
|
||||
'backstage.concerts.update',
|
||||
'backstage.published-concerts.store',
|
||||
'backstage.published-concert-orders.index',
|
||||
'backstage.concert-messages.new',
|
||||
'backstage.concert-messages.store',
|
||||
];
|
||||
|
||||
foreach ($routes as $route) {
|
||||
$this->assertContains(
|
||||
ForceStripeAccount::class,
|
||||
Route::getRoutes()->getByName($route)->gatherMiddleware()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user