Just write test classes, preferably mirroring your framework structure (eg ControllerTest
, ModelTest
, etc), that put the classes through their paces, meaning putting in some data and checking the output. If your code is well-structured, should be quite easy to implement.
Edit
Basically, what you test in a unit test is if ( Class::methodToTest( $input ) === $expected_output )
. The output must always be identical for the same $input
. If this is not the case, or you can't test write a test case like this, it's often an indicator that your code is not well structured (object oriented and loosely coupled).
Your Template::render()
method for example, is not testable because it prints the data instead of returning it. Now, you could work around this by using ob_start()
, but better anyway would be to chop the function into smaller parts, that return values instead of directly printing them.
It's a bit abstract, but I hope you get the point.