I'm unit-testing some PHP code with SimpleTest and I've run into trouble. In my tests of a database class I want to be able to set an expectation for PHPs mysql
functions. In my tests of a wrapper class for the mail
function I want to mock PHPs mail
function. These are just some examples.
The point is: I don't (always) want to test if my Mail class sends e-mail, I want to test how it calls the mail
function. I want to be able to control what these functions return. I want to be able to test my Database class without needing a database, fixtures and that whole lot.
I've got some experience with testing Ruby code, and Test::Unit and RSpec make it very easy to test code in isolation. I'm new to testing PHP and it feels like I'm testing a lot more than I should need to, in order to get my tests to pass.
Is there a way in SimpleTest or PhpUnit or some other testing framework that makes this possible or easier?