function testDao() { $da = new MockDataAccess($this); $dar = new MockDataAccessResult($this); $da->setReturnReference('query', $dar); $dao = new DataAccessObject($da); $result = $dao->retrieve("SELECT *"); $this->assertIsA($result, 'MockDataAccessResult'); }
function testSuspendUserNotAddedToAnyProject() { $darUser = new MockDataAccessResult($this); $darUser->setReturnValueAt(0, 'valid', true); $darUser->setReturnValueAt(1, 'valid', false); $darUser->setReturnValue('current', array('user_id' => 112)); $dao = new UserDaoTestValidity($this); $dao->expectOnce('returnNotProjectMembers'); $dao->setReturnReference('returnNotProjectMembers', $darUser); $darNewMember = new MockDataAccessResult($this); $darNewMember->setReturnValueAt(0, 'valid', true); $darNewMember->setReturnValueAt(1, 'valid', false); $darNewMember->setReturnValue('isError', false); $darNewMember->setReturnValue('rowCount', 0); $dao->expectOnce('delayForBeingNotProjectMembers', array(112)); $dao->setReturnReference('delayForBeingNotProjectMembers', $darNewMember, array(112)); $darAddDate = new MockDataAccessResult($this); $darAddDate->setReturnValueAt(0, 'valid', true); $darAddDate->setReturnValueAt(1, 'valid', false); $darAddDate->setReturnValue('isError', false); $darAddDate->setReturnValue('rowCount', 1); $dao->expectOnce('delayForBeingSubscribed', array(112, 1258307747)); $dao->setReturnReference('delayForBeingSubscribed', $darAddDate, array(112, 1258307747)); $da = new MockDataAccess($this); $da->setReturnValue('escapeInt', 112, array(112)); $dao->da = $da; $dao->expectOnce('suspendAccount', array('user.user_id = 112')); $dao->suspendUserNotProjectMembers(1258307747); }