public function testIsApplicationAdminIfConfigured() { $email = '*****@*****.**'; $user = new User(); $user->ChangeEmailAddress($email); $this->fakeConfig->SetKey(ConfigKeys::ADMIN_EMAIL, $email); $actualIsAdmin = $this->authorizationService->IsApplicationAdministrator($user); $this->assertTrue($actualIsAdmin); }
public function testUpdateSetsUserProperties() { $userId = 987; $loginTime = '2010-01-01'; $language = 'en_gb'; $user = new User(); $user->WithId($userId); $password = '******'; $salt = 'salt'; $homepageId = 19; $fname = 'f'; $lname = 'l'; $email = 'e'; $username = '******'; $timezone = 'America/New_York'; $scheduleId = 99; $user->ChangePassword($password, $salt); $user->ChangeName($fname, $lname); $user->ChangeEmailAddress($email); $user->ChangeUsername($username); $user->ChangeDefaultHomePage($homepageId); $user->ChangeTimezone($timezone); $user->EnableSubscription(); $user->Login($loginTime, $language); $user->ChangeDefaultSchedule($scheduleId); $publicId = $user->GetPublicId(); $command = new UpdateUserCommand($userId, $user->StatusId(), $password, $salt, $fname, $lname, $email, $username, $homepageId, $timezone, $loginTime, true, $publicId, $language, $scheduleId); $repo = new UserRepository(); $repo->Update($user); $this->assertTrue($this->db->ContainsCommand($command)); }