Jump to the navigation menu

The best solution is the one that gets the tests to pass

As I said yesterday, there is no perfect solution or approach for every situation.

However, when doing test-driven development, there is a best solution.

The simplest thing that gets a failing test to pass.

Whether it's hard-coding a return value or putting the initial logic in a Controller, that's the objective.

Once the test is passing, you can refactor the code or continue writing tests, which will each have their own best solution.

- Oliver

Was this interesting?

Sign up here and get more like this delivered straight to your inbox every day.

About me

Picture of Oliver

I'm an certified Drupal Triple Expert with 18 years of experience, a Drupal core contributor, public speaker, live streamer, and host of the Beyond Blocks podcast.