Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.10 KB | None | 0 0
  1.  
  2.     static testMethod void testRegistration(){
  3.  
  4.         Account ac = new Account(name ='Test');
  5.         insert ac;
  6.  
  7.         Contact con = new Contact(LastName ='testCon',AccountId = ac.Id, Phone = '+32475555555');
  8.         insert con;
  9.  
  10.         Profile p = [SELECT Id FROM profile WHERE name='Partner Community Full'];
  11.         UserRole portalRole = [Select Id From UserRole Where PortalType = 'None' Limit 1];
  12.  
  13.         User user = new User(alias = 'test123', email='test123@noemail.com',
  14.                 emailencodingkey='UTF-8', lastname='Testing', languagelocalekey='en_US',
  15.                 localesidkey='en_US', profileid = p.Id, country='United States',IsActive =true,
  16.                 ContactId = con.Id,
  17.                 timezonesidkey='America/Los_Angeles', username='tester@noemail.com');
  18.         user.UserRoleId = portalRole.Id;
  19.        
  20.         system.runAs(user) {
  21.             // statements to be executed by this test user.
  22.  
  23.             System.debug('test');
  24.             Account test = [SELECT IsPartner FROM Account WHERE  Id =: ac.Id];
  25.             System.debug(test);
  26.         }
  27.  
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement