public function testWalkPartsForStreamFile() { // create a temporary file $tmpFile = tempnam(sys_get_temp_dir(), "stream"); file_put_contents($tmpFile, "content"); // create mail instance $mail = new ezcMailComposer(); $mail->addAttachment($tmpFile); $mail->build(); // create the testing context $context = new ezcMailPartWalkContext(function ($ctx, $part) { $this->assertInstanceOf('ezcMailStreamFile', $part); }); $context->filter = ['ezcMailStreamFile']; // test it $mail->walkParts($context, $mail); // remove the temporary file @unlink($tmpFile); }