DEV Community

Discussion on: What are your thoughts on functional programming? In PHP?

 
joshualjohnson profile image
Joshua Johnson

Nice! Different stuff works for different people. I find no value in writing individual units. Never have I ever caught a bug because a unit test failed. I did catch a bug because my functional test failed though.

Even recently. My test was written in a way such that I expected that if the user tried to access a class that didn't exist within a DI container, that the code would throw an exception. Turns out that the code was written such that if the DI container didn't contain the class it would throw an exception in php 7.1, but not 7.3. That is a bug that I wouldn't have been able to catch if I mocked everything and spent time writing individual unit tests.

Thread Thread
 
underscorefunk profile image
John Funk

Totally agree. Different strokes.

And I hear ya about the need for other tests and assurances too. I wouldn't ever think, "I have unit tests, so everything is perfect."

And I've written loads of code that isn't tested at all and had zero problems.

I can say this much. I DEFINITELY dislike TDD when working with OOP. :)