apex-enterprise-patterns / fflib-apex-common

Common Apex Library supporting Apex Enterprise Patterns and much more!
BSD 3-Clause "New" or "Revised" License
913 stars 517 forks source link

add support for undelete trigger events to domain layer #18

Closed ghost closed 9 years ago

ghost commented 10 years ago

For completeness, it may be possible to cover all verbs so that a consumer may implement:

a.la: https://github.com/financialforcedev/fflib-apex-common/blob/master/fflib/src/classes/fflib_SObjectDomain.cls#L123

afawcett commented 10 years ago

Great idea, thanks!

maximorojr commented 9 years ago

Is there any news about that?

afawcett commented 9 years ago

Sorry no progress on this.

I'll gladly accept a pull request though.... :+1:

Autobat commented 9 years ago

I've a client that is using fflib and we need to support some undelete behavior. Once we have the extension done and tested i'll make the code available.

afawcett commented 9 years ago

@Autobat thats awesome, thanks!

Autobat commented 9 years ago

Undelete is in and working however I'm not 100% sure on the following. The current test harness uses mocking for the domain layer, is it possible to mock the recycle bin or should i revert to testing with DML?

afawcett commented 9 years ago

Not its not, if you want to follow the intent of the MockDatabase support in the Domain class. The intent is to simply access the routing functionality not to mock the event that generates the event. So a new method on MockDatabase say onUndelete(List records) would then set the records member (which mocks the new list/map) along with a new isUndeleted member. Then i assume in your changes you've extended the method signature of the private triggerHandler method. If so, update the testTriggerHandler method, to pass the new isUndeleted member. Note that this framework was put in place before ApexMocks existed btw, updating it to use that is outside the scope of this PR in my view.

Autobat commented 9 years ago

Ah thank you for the point in the right direction. I quickly skimmed the test class and did not grasp what it was doing in enough detail.

Will create the test for the undelete path and have it ready for your review

On Tue, Jul 28, 2015 at 5:45 PM, Andrew Fawcett notifications@github.com wrote:

Not its not, if you want to follow the intent of the MockDatabase support in the Domain class. The intent is to simply access the routing functionality not to mock the event that generates the event. So a new method on MockDatabase say onUndelete(List records) would then set the records member (which mocks the new list/map) along with a new isUndeleted member. Then i assume in your changes you've extended the method signature of the private triggerHandler method. If so, update the testTriggerHandler method, to pass the new isUndeleted member. Note that this framework was put in place before ApexMocks existed btw, updating it to use that is outside the scope of this PR in my view.

— Reply to this email directly or view it on GitHub https://github.com/financialforcedev/fflib-apex-common/issues/18#issuecomment-125486108 .

afawcett commented 9 years ago

Thanks for the contribution! :+1:

afawcett commented 8 years ago

FYI: https://success.salesforce.com/ideaView?id=08730000000Brm1