Skip to content

Instantly share code, notes, and snippets.

@gbutt
Last active April 9, 2020 21:52
Show Gist options
  • Save gbutt/cd776a47edc2cf6a1c63a02b9012a93f to your computer and use it in GitHub Desktop.
Save gbutt/cd776a47edc2cf6a1c63a02b9012a93f to your computer and use it in GitHub Desktop.
@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