Closed kermorgant closed 6 years ago
Reminder about the use for this repository: report issues with the book. Maybe for asking questions you can reach us out through email or Twitter 👍
Thanks a lot for your words. I'm not sure I follow your question? Singletons are complicated with tests as they break isolation. Static methods break OO, when you don't have an instance, you cannot replace it easily with a Test Double for your tests… Unless you inject the DateTime somewhere, you'll find quite hard to make your tests follow specific flows in the System Under Test.
Hello,
First, thanks for this book, still in the first half but a great read so far :+1:
I've taken inspiration of the external fake MyCustomDateTimeBuilder for my tests, but I failed to understand how it can work with static methods, when calling "setReturnDates" (I used a singleton to have a shared instance).