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(
'host' => 'imap.example.com',
'user' => 'report@example.dk',
'password' => 'secret'));

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

// here the content is parsed

        } catch (
Zend_Mail_Exception $e) {
// ignore

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.