public function testGetSearchCols() { $this->assertEquals(['first_name', 'last_name'], $this->model->getSearchCols()); $this->assertEquals(['first_name'], $this->model->getSearchCols(['first_name'])); User::$searchCols = null; $this->assertEquals(['first_name', 'last_name'], $this->model->getSearchCols()); User::$labelCol = null; $this->assertEquals(['first_name'], $this->model->getSearchCols(null, ['first_name'])); $this->assertEquals(false, $this->model->getSearchCols()); }
public function run() { DB::table('users')->delete(); User::create(['first_name' => 'Admin', 'last_name' => 'User', 'email' => '*****@*****.**', 'username' => 'admin', 'password' => '123']); }
/** * Login, do this first * * @return void * @return \Illuminate\Http\Response */ public function login() { if (is_null($this->user)) { $this->user = User::all()->first(); } $response = $this->call('POST', static::$apiPath . '/user/login', ['username' => $this->user->username, 'password' => $this->user->password]); $token = json_decode($response->getContent())->data->api_key; $this->session(['token' => $token]); return $response; }