Index: tests/Zend/Log/Writer/MailTest.php =================================================================== --- tests/Zend/Log/Writer/MailTest.php (revision 22826) +++ tests/Zend/Log/Writer/MailTest.php (working copy) @@ -324,6 +324,77 @@ return array($mail, $writer, $log, $layout); } + + public function testFactoryGetInstance() + { + $mail = $this->getMock('Zend_Mail', array('send')); + $layout = $this->getMock('Zend_Layout', array('render')); + + $config = array( + array( + 'writerName' => 'Mail', + 'writerParams' => array(), + ), + ); + $log = Zend_Log::factory($config); + } + + public function testFactorySendingObjects() + { + $mail = $this->getMock('Zend_Mail', array('send')); + $layout = $this->getMock('Zend_Layout', array('render')); + + $config = array( + array( + 'writerName' => 'Mail', + 'writerParams' => array( + 'mail' => $mail, + 'mailparams' => array('replyto' => 'bob@dylan'), + 'layout' => $layout + ), + ), + ); + $log = Zend_Log::factory($config); + + $log->info('an info message'); + $log->warn('a warning message'); + } + + public function testFactorySendingInvalidMailClass() + { + $mail = $this->getMock('Zend_Mail', array('send')); + $layout = $this->getMock('Zend_Layout', array('render')); + + $config = array( + array( + 'writerName' => 'Mail', + 'writerParams' => array( + 'mail' => 'stdClass' + ), + ), + ); + + $this->setExpectedException('Zend_Log_Exception'); + $log = Zend_Log::factory($config); + } + + public function testFactorySendingInvalidLayoutClass() + { + $mail = $this->getMock('Zend_Mail', array('send')); + $layout = $this->getMock('Zend_Layout', array('render')); + + $config = array( + array( + 'writerName' => 'Mail', + 'writerParams' => array( + 'layout' => 'stdClass' + ), + ), + ); + + $this->setExpectedException('Zend_Log_Exception'); + $log = Zend_Log::factory($config); + } } // Call Zend_Log_Writer_MailTest::main() if this source file is executed directly.