I am curious as to how others approach this. Writing a test ain't so bad, but mocking kind of sucks a bit and cuts my flow. Is it ok for one to have a 'fixtures' directory and have say mock_db.php for example with just that particular mock declaration?
Going one step further, would it be bad practice to have those mocks abstracted in a function?
Ie:
// function to include a db mock
include_once 'test/fixtures/dbmock.php';
$mockMYSQL = $dbmock('mysql', 'db1');
$mockMSSQL = $dbmock('mssql', 'db2');
JUst interested to know how other experienced testers handle this. I'm writing scripts to sync 2 databases so this example may become very relevant.
$this->getMock('<class>')or are these custom-written mocks? Using fixtures to create test support objects is perfectly valid and recommended.