If you have no idea how the code works, poking and prodding seems like the best place to start. Once you start to reason about the flow and understand things enough, start adding tests. Basically, do whatever it takes to get the code under test.
You definitely want to be cautious and defensive in this process.
If you have time to read or study, the book Working Effectively with Legacy Code might give you some ideas on how to be defensive.
I'm a small business programmer. I love solving tough problems with Python and PHP. If you like what you're seeing, you should probably follow me here on dev.to and then checkout my blog.
Uncle Bob had a recent Twitter thread about this too: twitter.com/unclebobmartin/status/...
If you have no idea how the code works, poking and prodding seems like the best place to start. Once you start to reason about the flow and understand things enough, start adding tests. Basically, do whatever it takes to get the code under test.
If you have time to read or study, the book Working Effectively with Legacy Code might give you some ideas on how to be defensive.
Yeah, this is definitely territory where UncleBobeology shines.
+1 for Working Effectively with Legacy Code - excellent book!