I have a library that seems to work as intended. I would like to add some instrumentation to the library to capture (some) current input and the result and save that as a test case. Is there a library or tool for PHP to do this?
In short: given (1) current source code and (2) some example execution runs, output (3) test cases to verify that these execution runs repeat the same after the source code has been modified without repeating the example execution runs manually.
Ideally, I could mark a class or a function or method as "experimental" and this tool or library would generate test cases for this class/function/method that submits recorded input and saves computed output. Generating test cases for all methods executed during the example execution run would probably generate too much noise.
Obviously tests generated this way would be far from perfect but I'd guess these tests would be good at capturing accidental code regressions.
Can you suggest anything? I'm aware of Selenium but recording tools for that seem to test much bigger parts of the system. I'm looking more for a tool that is closer to unit testing and possibly would generate test cases (in source code form) that are understandable enough to be improved in the future.