Mock.php

Go to the documentation of this file.
00001 <?php
00002 
00034 class Robo47_Mock
00035 {
00036 
00040     protected $_data = array();
00044     public $mockData = array(
00045         'call' => array(),
00046         'get' => array(),
00047         'set' => array(),
00048     );
00049 
00053     public function __construct()
00054     {
00055         $args = func_get_args();
00056         $this->_logCall('__construct', $args);
00057     }
00058 
00065     public function __call($name, $arguments)
00066     {
00067         $this->_logCall($name, $arguments);
00068     }
00069 
00076     protected function _logCall($name, $arguments)
00077     {
00078         $this->mockData['call'][] = array($name, $arguments);
00079     }
00080 
00086     protected function _logGet($name)
00087     {
00088         $this->mockData['get'][] = $name;
00089     }
00090 
00097     protected function _logSet($name, $value)
00098     {
00099         $this->mockData['set'][] = array($name, $value);
00100     }
00101 
00108     public function __set($name, $value)
00109     {
00110         $this->_data[$name] = $value;
00111         $this->_logSet($name, $value);
00112     }
00113 
00120     public function __get($name)
00121     {
00122         $this->_logGet($name);
00123         if (isset($this->_data[$name])) {
00124             return $this->_data[$name];
00125         }
00126         return null;
00127     }
00128 }