function test_delete() { $user = new User(); $rand = md5(rand()); $user->username = '******' . $rand; $user->fullname = 'This is the name'; $user->email = "{$rand}@email.com"; $user->save(); $this->assertNotNull(User::by_username($user->username)); $user->delete(); $this->assertNull(User::by_username($user->username)); }
public static function authenticate($username, $password, $remember = false) { $user = User::by_username($username); if (!$user) { return false; } if ($user->check_password($password)) { Auth::login($user); return true; } else { return false; } }