Last active
April 9, 2020 21:52
-
-
Save gbutt/cd776a47edc2cf6a1c63a02b9012a93f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IsTest(IsParallel =false) // ContentWorkspace | |
public class InsertContentDocumentLinkTest { | |
@IsTest | |
static void do_a_thing() { | |
CollaborationGroup unlistedGroup = new CollaborationGroup( | |
Name = 'Unlisted', | |
CollaborationType = 'Unlisted' | |
); | |
insert unlistedGroup; | |
ContentVersion docVer = new ContentVersion( | |
Title ='My Doc', | |
PathOnClient = 'test.csv', | |
VersionData = EncodingUtil.base64Decode('Content Version lib test') | |
); | |
insert docVer; | |
ContentDocument doc = [SELECT Id FROM ContentDocument]; | |
ContentDocumentLink commlink = new ContentDocumentLink( | |
ContentDocumentId = doc.Id, | |
LinkedEntityId = unlistedGroup.Id, | |
ShareType = 'V', | |
Visibility = 'AllUsers' | |
); | |
insert commlink; | |
System.assertNotEquals(null, commLink.Id); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment