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'); } /** * Set specific Webkul/Core configuration keys to a given value * * // TODO: change method as soon as there is a method to set core config data * * @param $data array containing 'code => value' pairs * @return void */ public function setConfigData($data): void { foreach ($data as $key => $value) { if (DB::table('core_config')->where('code', '=', $key)->exists()) { DB::table('core_config')->where('code', '=', $key)->update(['value' => $value]); } else { DB::table('core_config')->insert([ 'code' => $key, 'value' => $value, 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s') ]); } } } }