fideloper / Implementing-Laravel

Companion application to the e-book Implementing Laravel
173 stars 40 forks source link

Please reconsider tests as 'central to the book' #12

Open Morgon opened 11 years ago

Morgon commented 11 years ago

[In reference to #2]

Since everyone in the PHP community (even outside of Laravel) are pushing tests now, I might (personally, of course) challenge your statement that tests aren't central to a book about creating an application using Laravel.

There are at least 3 people including myself who have questioned this. I, myself, have often questioned the need for testing. But we're coming to a point where the case cannot be ignored.

I do think having at least a couple of quick sample tests would help a great deal. Just something to show the practicality of testing, and instances where it may help us catch issues.

fideloper commented 11 years ago

Hi!

So there are two very important things I'm considering when hearing this feedback from you and others:

  1. There's an entire book on testing in Laravel
  2. My book is about architecting code in Laravel, not about testing it.

I try to answer "How do I use these principles I'm learning about".

Architecting code is about making code both testable and maintainable. I likely should have emphasized long term maintainability more, as that's where my head mostly is at when writing. My point of view is that really these goals (testable, maintainable) are one in the same. Testable code is also maintainable.

However, adding some tests to the application code can definitely be beneficial. I'll see what I can do there.

To reiterate: I don't plan on doing much writing on the subject of testing in the book. That's beyond the book's scope and purpose. I do, however, see the benefit of adding in a test or two to "prove" that I've actually created more testable code. The book does appear to "assume" it makes code more testable, by virtue of using dependency injection and other design principles.

I will also definitely consider where I put emphasis within my writing. "Testable and Maintainable" is a phrase I started with early in the book's creation. However, it content ended up definitely being more about maintainability and code architecture.

Lastly, I believe the reaction of the few asking about tests is more because I didn't correctly set expectations in regards to tests, rather than because tests aren't present (sorry!).

Thanks again for your feedback, I do appreciate it.

summerblue commented 10 years ago

Just a little disappointed did'n see the Test code for this project.

Great Book by the way.

fideloper commented 10 years ago

Over the last week or two I've worked on and off on adding some tests. This is where I am so far with them. That feature branch will get merged when ready (or possibly even sooner).

summerblue commented 10 years ago

:thumbsup: :sparkles: