protected function newUser(array $row) { $user = new User(); $user->setId($row['id']); $user->setStatus($row['status']); $user->setName($row['name']); return $user; }
/** * @return \Fusio\Engine\Repository\UserInterface */ protected function createRepository() { $user = new User(); $user->setId(1); $user->setName('foo'); $repository = new Repository\UserMemory(); $repository->add($user); return $repository; }
/** * @return \Fusio\Engine\Context */ protected function getContext() { $app = new App(); $app->setAnonymous(false); $app->setId(3); $app->setUserId(2); $app->setStatus(1); $app->setName('Foo-App'); $app->setUrl('http://google.com'); $app->setParameters(['foo' => 'bar']); $app->setScopes(['foo', 'bar']); $app->setAppKey('5347307d-d801-4075-9aaa-a21a29a448c5'); $user = new User(); $user->setAnonymous(false); $user->setId(2); $user->setStatus(0); $user->setName('Consumer'); $action = new Action(); $action->setId(uniqid()); $action->setName('foo'); $action->setDate(date('Y-m-d H:i:s')); return new Context(34, $app, $user, $action); }
/** * @param integer $userId * @return \Fusio\Engine\Model\UserInterface */ private function getUser($userId) { $user = $this->userRepository->get($userId); if (!$user instanceof Model\UserInterface) { $user = new Model\User(); $user->setAnonymous(true); } return $user; }