You need to sign in to do that
Don't have an account?
Drebin
Make a test class for a before delete trigger
Hi everyone,
I have this trigger to delete a document when a lead is deleted :
Can you please help me with to make an apex test class for this code ? I tried to develop it but I'm still with 0% code coverage
Thanks a lot !
Frédéric
I have this trigger to delete a document when a lead is deleted :
trigger DeleteImageLead on Lead (before delete) { if (Trigger.isDelete) { for (Lead l : Trigger.old) { List<ContentDocument> myFeed = [SELECT LatestPublishedVersionId FROM ContentDocument WHERE Id In (SELECT ContentDocumentId FROM ContentVersion WHERE Id =:l.PhotoLead_Image__c)]; delete myFeed; } } }When I deploy it on a production environment, I have a code coverage error because it is 0%.
Can you please help me with to make an apex test class for this code ? I tried to develop it but I'm still with 0% code coverage
Thanks a lot !
Frédéric
All Answers
It works great, thanks !
Can you help me with that.
Thanks !
Thanks a lot, it's 100% code coverage now !
And here's my test class that returns 0% coverage: