Unit testing with singletons

Have a look at the Google Testing blog:

  • Using dependency injection to avoid singletons
  • Singletons are Pathological Liars
  • Root Cause of Singletons
  • Where have all the Singletons Gone?
  • Clean Code Talks – Global State and Singletons
  • Dependency Injection.

And also:

  • Once Is Not Enough
  • Performant Singletons

Finally, Misko Hevery wrote a guide on his blog: Writing Testable Code.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)