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() { $this->environ->clean(); $user1Id = $this->environ->createUser('jsmith', 'joe smith', '*****@*****.**'); $joeUser = new UserModel($user1Id); $user2Id = $this->environ->createUser('zedUser', 'zed user', '*****@*****.**'); $zedUser = new UserModel($user2Id); $identityCheck = UserCommands::checkUniqueIdentity($zedUser, 'jsmith', '*****@*****.**', $this->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); }