I understand unit testing and find out how to split my code into test bits, but I don’t understand how I can write my own code of a higher level, for example, my controller so that testing the controller does not require passing the actual data level (which is independently tested in another place of my test suite).
For example, I have a user check that accepts a username / password and checks their account and returns login success / failure:
class Api_AuthController extends Zend_Controller_Action
{
public function validateUserAction()
{
$accountMapper = new Application_Model_Mapper_Account();
$accounts = $accountMapper(find(array('username' => $username, 'password' => $password));
if (count($accounts) == 1) {
} else {
}
}
}
, Application_Model_Mapper_Account find() unit test, (, , - , , ) , , , - .
- mocks mapper model , validateUserAction?