public function check_unique_identity($userId, $updatedUsername, $updatedEmail) { if ($userId) { $user = new UserModel($userId); } else { $user = new UserModel(); } $identityCheck = UserCommands::checkUniqueIdentity($user, $updatedUsername, $updatedEmail); return JsonEncoder::encode($identityCheck); }
public function testCheckUniqueIdentity_userExist() { self::$environ->clean(); $user1Id = self::$environ->createUser('jsmith', 'joe smith', '*****@*****.**'); new UserModel($user1Id); $user2Id = self::$environ->createUser('zedUser', 'zed user', '*****@*****.**'); $zedUser = new UserModel($user2Id); $identityCheck = UserCommands::checkUniqueIdentity($zedUser, 'jsmith', '*****@*****.**', self::$environ->website); $this->assertTrue($identityCheck->usernameExists); $this->assertTrue($identityCheck->usernameExistsOnThisSite); $this->assertFalse($identityCheck->usernameMatchesAccount); $this->assertTrue($identityCheck->emailExists); $this->assertFalse($identityCheck->emailIsEmpty); $this->assertFalse($identityCheck->emailMatchesAccount); }