Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static testMethod void testRegistration(){
- Account ac = new Account(name ='Test');
- insert ac;
- Contact con = new Contact(LastName ='testCon',AccountId = ac.Id, Phone = '+32475555555');
- insert con;
- Profile p = [SELECT Id FROM profile WHERE name='Partner Community Full'];
- UserRole portalRole = [Select Id From UserRole Where PortalType = 'None' Limit 1];
- User user = new User(alias = 'test123', email='test123@noemail.com',
- emailencodingkey='UTF-8', lastname='Testing', languagelocalekey='en_US',
- localesidkey='en_US', profileid = p.Id, country='United States',IsActive =true,
- ContactId = con.Id,
- timezonesidkey='America/Los_Angeles', username='tester@noemail.com');
- user.UserRoleId = portalRole.Id;
- system.runAs(user) {
- // statements to be executed by this test user.
- System.debug('test');
- Account test = [SELECT IsPartner FROM Account WHERE Id =: ac.Id];
- System.debug(test);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement