I have Apex triggers on ContentDocument and ContentDocumentLink Sobject.

I wrote my Apex Unit Tests for those triggers and I was creating more then one Content Data record to test the Logic in Bulk.

After several Unit test running I got the error: System.UnexpectedException: ContentPublication Limit exceeded.

I have encounter the System limit "maximum number of versions that can be published in a 24-hour".

It looks like system sees those test Content as real and is counting the number against the limit. I thought that those kind of limits where not counted in the Unit Tests.

Is this a bug? Is there any one having a solution at that issue?

Thanks a lot.

  • are you doing this within a test.starttest() - test.stopTest() block? – cropredy Dec 10 '16 at 19:19
  • Are you performing multiple insert operations against ContentVersion? – Adrian Larson Dec 10 '16 at 19:20
  • I am performing one insert of a list of ContentVersion with more then one row within Test.startTest() and Test.stopTest(). – MarcoDev Dec 10 '16 at 19:29
  • Hi @MarcoDev, did you get any further with this? I am facing same issue. Surprised that test records created within startTest() and stopTest() are counted against limit. – MikeA Nov 27 '17 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.