On our managed package, we have a PostInstallClass that implements the InstallHandler interface. We use it to populate new fields when they are added in later versions, or fix data when the model changes.
However, we have trouble finding a way to test this migrations. For instance: we added a new field that is used in a trigger. We want to insert some records with that field emtpy (as it will be when creating the field), but without firing the trigger, which would fail.
Is there any way that we can do something like this?
I would suggest implementing a protected custom setting object (Protected, because your don’t want your subscribers to be able to modify it). This was you can disable your trigger e.g
Then in the unit test you can control whether the trigger performs it’s actions