web/lib/Zend/Log/Writer/Mock.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     1 <?php
       
     2 /**
       
     3  * Zend Framework
       
     4  *
       
     5  * LICENSE
       
     6  *
       
     7  * This source file is subject to the new BSD license that is bundled
       
     8  * with this package in the file LICENSE.txt.
       
     9  * It is also available through the world-wide-web at this URL:
       
    10  * http://framework.zend.com/license/new-bsd
       
    11  * If you did not receive a copy of the license and are unable to
       
    12  * obtain it through the world-wide-web, please send an email
       
    13  * to license@zend.com so we can send you a copy immediately.
       
    14  *
       
    15  * @category   Zend
       
    16  * @package    Zend_Log
       
    17  * @subpackage Writer
       
    18  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    20  * @version    $Id: Mock.php 20096 2010-01-06 02:05:09Z bkarwin $
       
    21  */
       
    22 
       
    23 /** Zend_Log_Writer_Abstract */
       
    24 require_once 'Zend/Log/Writer/Abstract.php';
       
    25 
       
    26 /**
       
    27  * @category   Zend
       
    28  * @package    Zend_Log
       
    29  * @subpackage Writer
       
    30  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    31  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    32  * @version    $Id: Mock.php 20096 2010-01-06 02:05:09Z bkarwin $
       
    33  */
       
    34 class Zend_Log_Writer_Mock extends Zend_Log_Writer_Abstract
       
    35 {
       
    36     /**
       
    37      * array of log events
       
    38      */
       
    39     public $events = array();
       
    40 
       
    41     /**
       
    42      * shutdown called?
       
    43      */
       
    44     public $shutdown = false;
       
    45 
       
    46     /**
       
    47      * Write a message to the log.
       
    48      *
       
    49      * @param  array  $event  event data
       
    50      * @return void
       
    51      */
       
    52     public function _write($event)
       
    53     {
       
    54         $this->events[] = $event;
       
    55     }
       
    56 
       
    57     /**
       
    58      * Record shutdown
       
    59      *
       
    60      * @return void
       
    61      */
       
    62     public function shutdown()
       
    63     {
       
    64         $this->shutdown = true;
       
    65     }
       
    66 
       
    67     /**
       
    68      * Create a new instance of Zend_Log_Writer_Mock
       
    69      * 
       
    70      * @param  array|Zend_Config $config
       
    71      * @return Zend_Log_Writer_Mock
       
    72      * @throws Zend_Log_Exception
       
    73      */
       
    74     static public function factory($config) 
       
    75     {
       
    76         return new self();
       
    77     }
       
    78 }