login($I->grabRecord(Admin::class, ['email' => 'admin@example.com'])); $I->seeAuthentication('admin'); } /** * Go to a specific route and check if admin guard is applied on it * * @param string $name name of the route * @param array|null $params params the route will be created with */ public function amOnAdminRoute(string $name, array $params = null): void { $I = $this; $I->amOnRoute($name, $params); $I->seeCurrentRouteIs($name); /** @var RouteCollection $routes */ $routes = Route::getRoutes(); $middlewares = $routes->getByName($name)->middleware(); $I->assertContains('admin', $middlewares, 'check that admin middleware is applied'); } }