I have a legacy app that I need to get under test. This is a cronjob from the app.

PHP Code:
$mail = new Zend_Mail_Storage_Imap(
  array(
'host' => 'imap.example.com',
          
'user' => 'report@example.dk',
          
'password' => 'secret'));

foreach (
$mail as $msgnum => $message) {
    foreach (new 
RecursiveIteratorIterator($message) as $part) {
        try {
            if(
$part->contentType == 'application/octet-stream; name="report.csv"') {
                
$content base64_decode($part->getContent());
                unset(
$events);
                unset(
$imported_lines);
                
$count++;
                
$date date("Y-m-d_H-i-s");
                
$filename $date."_".$count."_report.csv";
                
file_put_contents('/place/on/server/reports/'.$filename$content);

                
// here the content is parsed
            
}

        } catch (
Zend_Mail_Exception $e) {
            
// ignore
        
}
    }
    
delmail($mail$msgnum);

I need to be able to make another solution for the e-mail check - something that I can substitute Zend_Mail_Storage_Imap with. Do I create a completely fake Fake_Mail_Storage__Imap, can I create a mock, or is it a stub? Getting a bit confused Hope you can clarify stuff a bit.