Is there anything built into
Apex that lets one perform a
CRUD operation on an
SObject and suppress the related firing of any
Apex Trigger /
Workflow Rule /
(Similarly to the way one can spoof a create date, spoof the run-as user, etc.)
I've written some "helper" code to support a variety of trigger handlers. Since this code is called from the various trigger handlers, it actually has pretty good coverage without even trying to test it in a "pure" fashion.
But I'd like to give it its own test - that way, I know if my "helper" code actually does what I think it does, plus I can turn off triggers and still have coverage.
To exercise the "helper" code, some test records of the types it deals with have to exist. So my new test class has to insert them into the database.
However, that means I'll be invoking the triggers on all those
SObject types, making it hard to tell just how much my new code is directly responsible for working the "helper class."
I suppose I could turn those triggers off for a few hours while I write the new test class, but that's annoying - and feels less cool.