Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 1 | <?php |
| 2 | |
Pascal Kriete | fe372e3 | 2011-04-21 00:59:45 -0400 | [diff] [blame] | 3 | class CI_TestCase extends PHPUnit_Framework_TestCase { |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 4 | |
dchill42 | 7ecc5cd | 2012-10-12 16:25:51 -0400 | [diff] [blame] | 5 | public $ci_vfs_root; |
| 6 | public $ci_app_root; |
| 7 | public $ci_base_root; |
Pascal Kriete | ae7b3f9 | 2011-04-21 01:21:27 -0400 | [diff] [blame] | 8 | protected $ci_instance; |
| 9 | protected static $ci_test_instance; |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 10 | |
Pascal Kriete | ae7b3f9 | 2011-04-21 01:21:27 -0400 | [diff] [blame] | 11 | private $global_map = array( |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 12 | 'benchmark' => 'bm', |
| 13 | 'config' => 'cfg', |
| 14 | 'hooks' => 'ext', |
| 15 | 'utf8' => 'uni', |
| 16 | 'router' => 'rtr', |
| 17 | 'output' => 'out', |
| 18 | 'security' => 'sec', |
| 19 | 'input' => 'in', |
| 20 | 'lang' => 'lang', |
Greg Aker | 8da6903 | 2011-04-21 11:28:27 -0500 | [diff] [blame] | 21 | 'loader' => 'load', |
| 22 | 'model' => 'model' |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 23 | ); |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 24 | |
Eric Barnes | 68286a4 | 2011-04-21 22:00:33 -0400 | [diff] [blame] | 25 | // -------------------------------------------------------------------- |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 26 | |
Pascal Kriete | fe372e3 | 2011-04-21 00:59:45 -0400 | [diff] [blame] | 27 | public function __construct() |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 28 | { |
| 29 | parent::__construct(); |
dchill42 | 7ecc5cd | 2012-10-12 16:25:51 -0400 | [diff] [blame] | 30 | $this->ci_instance = new StdClass(); |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 31 | } |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 32 | |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 33 | // -------------------------------------------------------------------- |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 34 | |
Eric Barnes | 68286a4 | 2011-04-21 22:00:33 -0400 | [diff] [blame] | 35 | public function setUp() |
| 36 | { |
dchill42 | 7ecc5cd | 2012-10-12 16:25:51 -0400 | [diff] [blame] | 37 | // Setup VFS with base directories |
| 38 | $this->ci_vfs_root = vfsStream::setup(); |
| 39 | $this->ci_app_root = vfsStream::newDirectory('application')->at($this->ci_vfs_root); |
| 40 | $this->ci_base_root = vfsStream::newDirectory('system')->at($this->ci_vfs_root); |
dchill42 | 4f42be5 | 2012-10-21 21:31:19 -0400 | [diff] [blame] | 41 | $this->ci_view_root = vfsStream::newDirectory('views')->at($this->ci_app_root); |
Andrey Andreev | dd8d3d3 | 2012-11-03 02:09:05 +0200 | [diff] [blame] | 42 | vfsStream::newDirectory('config')->at($this->ci_app_root); |
| 43 | $this->ci_vfs_clone('application/config/autoload.php'); |
dchill42 | 7ecc5cd | 2012-10-12 16:25:51 -0400 | [diff] [blame] | 44 | |
Eric Barnes | 68286a4 | 2011-04-21 22:00:33 -0400 | [diff] [blame] | 45 | if (method_exists($this, 'set_up')) |
| 46 | { |
| 47 | $this->set_up(); |
| 48 | } |
| 49 | } |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 50 | |
Eric Barnes | 68286a4 | 2011-04-21 22:00:33 -0400 | [diff] [blame] | 51 | // -------------------------------------------------------------------- |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 52 | |
| 53 | public function tearDown() |
Eric Barnes | 68286a4 | 2011-04-21 22:00:33 -0400 | [diff] [blame] | 54 | { |
| 55 | if (method_exists($this, 'tear_down')) |
| 56 | { |
| 57 | $this->tear_down(); |
| 58 | } |
| 59 | } |
Taufan Aditya | e1dc9ea | 2012-03-28 16:49:49 +0700 | [diff] [blame] | 60 | |
| 61 | // -------------------------------------------------------------------- |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 62 | |
Taufan Aditya | e1dc9ea | 2012-03-28 16:49:49 +0700 | [diff] [blame] | 63 | public static function instance() |
| 64 | { |
| 65 | return self::$ci_test_instance; |
| 66 | } |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 67 | |
Eric Barnes | 68286a4 | 2011-04-21 22:00:33 -0400 | [diff] [blame] | 68 | // -------------------------------------------------------------------- |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 69 | |
dchill42 | 7ecc5cd | 2012-10-12 16:25:51 -0400 | [diff] [blame] | 70 | public function ci_set_config($key = '', $val = '') |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 71 | { |
dchill42 | 7ecc5cd | 2012-10-12 16:25:51 -0400 | [diff] [blame] | 72 | // Add test config |
| 73 | if ( ! isset($this->ci_instance->config)) |
| 74 | { |
| 75 | $this->ci_instance->config = new CI_TestConfig(); |
| 76 | } |
| 77 | |
| 78 | // Empty key means just do setup above |
| 79 | if ($key === '') |
| 80 | { |
| 81 | return; |
| 82 | } |
| 83 | |
Pascal Kriete | ae7b3f9 | 2011-04-21 01:21:27 -0400 | [diff] [blame] | 84 | if (is_array($key)) |
| 85 | { |
dchill42 | 7ecc5cd | 2012-10-12 16:25:51 -0400 | [diff] [blame] | 86 | $this->ci_instance->config->config = $key; |
Pascal Kriete | ae7b3f9 | 2011-04-21 01:21:27 -0400 | [diff] [blame] | 87 | } |
| 88 | else |
| 89 | { |
dchill42 | 7ecc5cd | 2012-10-12 16:25:51 -0400 | [diff] [blame] | 90 | $this->ci_instance->config->config[$key] = $val; |
Pascal Kriete | ae7b3f9 | 2011-04-21 01:21:27 -0400 | [diff] [blame] | 91 | } |
Pascal Kriete | fe372e3 | 2011-04-21 00:59:45 -0400 | [diff] [blame] | 92 | } |
Taufan Aditya | e1dc9ea | 2012-03-28 16:49:49 +0700 | [diff] [blame] | 93 | |
| 94 | // -------------------------------------------------------------------- |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 95 | |
| 96 | public function ci_get_config() |
Taufan Aditya | e1dc9ea | 2012-03-28 16:49:49 +0700 | [diff] [blame] | 97 | { |
dchill42 | 7ecc5cd | 2012-10-12 16:25:51 -0400 | [diff] [blame] | 98 | return isset($this->ci_instance->config) ? $this->ci_instance->config->config : array(); |
Taufan Aditya | e1dc9ea | 2012-03-28 16:49:49 +0700 | [diff] [blame] | 99 | } |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 100 | |
Pascal Kriete | fe372e3 | 2011-04-21 00:59:45 -0400 | [diff] [blame] | 101 | // -------------------------------------------------------------------- |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 102 | |
| 103 | public function ci_instance($obj = FALSE) |
Pascal Kriete | fe372e3 | 2011-04-21 00:59:45 -0400 | [diff] [blame] | 104 | { |
| 105 | if ( ! is_object($obj)) |
| 106 | { |
| 107 | return $this->ci_instance; |
| 108 | } |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 109 | |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 110 | $this->ci_instance = $obj; |
| 111 | } |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 112 | |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 113 | // -------------------------------------------------------------------- |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 114 | |
| 115 | public function ci_instance_var($name, $obj = FALSE) |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 116 | { |
Pascal Kriete | fe372e3 | 2011-04-21 00:59:45 -0400 | [diff] [blame] | 117 | if ( ! is_object($obj)) |
| 118 | { |
| 119 | return $this->ci_instance->$name; |
| 120 | } |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 121 | |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 122 | $this->ci_instance->$name =& $obj; |
| 123 | } |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 124 | |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 125 | // -------------------------------------------------------------------- |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 126 | |
| 127 | /** |
| 128 | * Grab a core class |
| 129 | * |
| 130 | * Loads the correct core class without extensions |
| 131 | * and returns a reference to the class name in the |
| 132 | * globals array with the correct key. This way the |
| 133 | * test can modify the variable it assigns to and |
| 134 | * still maintain the global. |
| 135 | */ |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 136 | public function &ci_core_class($name) |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 137 | { |
| 138 | $name = strtolower($name); |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 139 | |
Pascal Kriete | ae7b3f9 | 2011-04-21 01:21:27 -0400 | [diff] [blame] | 140 | if (isset($this->global_map[$name])) |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 141 | { |
| 142 | $class_name = ucfirst($name); |
Pascal Kriete | ae7b3f9 | 2011-04-21 01:21:27 -0400 | [diff] [blame] | 143 | $global_name = $this->global_map[$name]; |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 144 | } |
Pascal Kriete | ae7b3f9 | 2011-04-21 01:21:27 -0400 | [diff] [blame] | 145 | elseif (in_array($name, $this->global_map)) |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 146 | { |
Pascal Kriete | ae7b3f9 | 2011-04-21 01:21:27 -0400 | [diff] [blame] | 147 | $class_name = ucfirst(array_search($name, $this->global_map)); |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 148 | $global_name = $name; |
| 149 | } |
| 150 | else |
| 151 | { |
| 152 | throw new Exception('Not a valid core class.'); |
| 153 | } |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 154 | |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 155 | if ( ! class_exists('CI_'.$class_name)) |
| 156 | { |
dchill42 | 7ecc5cd | 2012-10-12 16:25:51 -0400 | [diff] [blame] | 157 | require_once SYSTEM_PATH.'core/'.$class_name.'.php'; |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 158 | } |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 159 | |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 160 | $GLOBALS[strtoupper($global_name)] = 'CI_'.$class_name; |
| 161 | return $GLOBALS[strtoupper($global_name)]; |
| 162 | } |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 163 | |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 164 | // -------------------------------------------------------------------- |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 165 | |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 166 | // convenience function for global mocks |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 167 | public function ci_set_core_class($name, $obj) |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 168 | { |
| 169 | $orig =& $this->ci_core_class($name); |
| 170 | $orig = $obj; |
| 171 | } |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 172 | |
dchill42 | 7ecc5cd | 2012-10-12 16:25:51 -0400 | [diff] [blame] | 173 | /** |
| 174 | * Create VFS directory |
| 175 | * |
| 176 | * @param string Directory name |
| 177 | * @param object Optional root to create in |
| 178 | * @return object New directory object |
| 179 | */ |
| 180 | public function ci_vfs_mkdir($name, $root = NULL) |
| 181 | { |
| 182 | // Check for root |
| 183 | if ( ! $root) |
| 184 | { |
| 185 | $root = $this->ci_vfs_root; |
| 186 | } |
| 187 | |
| 188 | // Return new directory object |
| 189 | return vfsStream::newDirectory($name)->at($root); |
| 190 | } |
| 191 | |
| 192 | // -------------------------------------------------------------------- |
| 193 | |
| 194 | /** |
| 195 | * Create VFS content |
| 196 | * |
| 197 | * @param string File name |
| 198 | * @param string File content |
| 199 | * @param object VFS directory object |
| 200 | * @param mixed Optional subdirectory path or array of subs |
| 201 | * @return void |
| 202 | */ |
| 203 | public function ci_vfs_create($file, $content = '', $root = NULL, $path = NULL) |
| 204 | { |
| 205 | // Check for array |
| 206 | if (is_array($file)) |
| 207 | { |
| 208 | foreach ($file as $name => $content) |
| 209 | { |
| 210 | $this->ci_vfs_create($name, $content, $root, $path); |
| 211 | } |
| 212 | return; |
| 213 | } |
| 214 | |
| 215 | // Assert .php extension if none given |
| 216 | if (pathinfo($file, PATHINFO_EXTENSION) == '') |
| 217 | { |
| 218 | $file .= '.php'; |
| 219 | } |
| 220 | |
| 221 | // Build content |
| 222 | $tree = array($file => $content); |
| 223 | |
| 224 | // Check for path |
| 225 | $subs = array(); |
| 226 | if ($path) |
| 227 | { |
| 228 | // Explode if not array |
| 229 | $subs = is_array($path) ? $path : explode('/', trim($path, '/')); |
| 230 | } |
| 231 | |
| 232 | // Check for root |
| 233 | if ( ! $root) |
| 234 | { |
| 235 | // Use base VFS root |
| 236 | $root = $this->ci_vfs_root; |
| 237 | } |
| 238 | |
| 239 | // Handle subdirectories |
| 240 | while (($dir = array_shift($subs))) |
| 241 | { |
| 242 | // See if subdir exists under current root |
| 243 | $dir_root = $root->getChild($dir); |
| 244 | if ($dir_root) |
| 245 | { |
| 246 | // Yes - recurse into subdir |
| 247 | $root = $dir_root; |
| 248 | } |
| 249 | else |
| 250 | { |
| 251 | // No - put subdirectory back and quit |
| 252 | array_unshift($subs, $dir); |
| 253 | break; |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | // Create any remaining subdirectories |
| 258 | if ($subs) |
| 259 | { |
| 260 | foreach (array_reverse($subs) as $dir) |
| 261 | { |
| 262 | // Wrap content in subdirectory for creation |
| 263 | $tree = array($dir => $tree); |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | // Create tree |
| 268 | vfsStream::create($tree, $root); |
| 269 | } |
| 270 | |
| 271 | // -------------------------------------------------------------------- |
| 272 | |
| 273 | /** |
| 274 | * Clone a real file into VFS |
| 275 | * |
| 276 | * @param string Path from base directory |
| 277 | * @return bool TRUE on success, otherwise FALSE |
| 278 | */ |
| 279 | public function ci_vfs_clone($path) |
| 280 | { |
dchill42 | e9435dc | 2012-10-14 15:44:39 -0400 | [diff] [blame] | 281 | // Check for array |
| 282 | if (is_array($path)) |
| 283 | { |
| 284 | foreach ($path as $file) |
| 285 | { |
| 286 | $this->ci_vfs_clone($file); |
| 287 | } |
| 288 | return; |
| 289 | } |
| 290 | |
dchill42 | 7ecc5cd | 2012-10-12 16:25:51 -0400 | [diff] [blame] | 291 | // Get real file contents |
| 292 | $content = file_get_contents(PROJECT_BASE.$path); |
| 293 | if ($content === FALSE) |
| 294 | { |
| 295 | // Couldn't find file to clone |
| 296 | return FALSE; |
| 297 | } |
| 298 | |
| 299 | $this->ci_vfs_create(basename($path), $content, NULL, dirname($path)); |
| 300 | return TRUE; |
| 301 | } |
| 302 | |
| 303 | // -------------------------------------------------------------------- |
| 304 | |
| 305 | /** |
| 306 | * Helper to get a VFS URL path |
| 307 | * |
| 308 | * @param string Path |
| 309 | * @param string Optional base path |
| 310 | * @return string Path URL |
| 311 | */ |
| 312 | public function ci_vfs_path($path, $base = '') |
| 313 | { |
| 314 | // Check for base path |
| 315 | if ($base) |
| 316 | { |
| 317 | // Prepend to path |
| 318 | $path = rtrim($base, '/').'/'.ltrim($path, '/'); |
| 319 | |
| 320 | // Is it already in URL form? |
| 321 | if (strpos($path, '://') !== FALSE) |
| 322 | { |
| 323 | // Done - return path |
| 324 | return $path; |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | // Trim leading slash and return URL |
| 329 | return vfsStream::url(ltrim($path, '/')); |
| 330 | } |
| 331 | |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 332 | // -------------------------------------------------------------------- |
Pascal Kriete | ae7b3f9 | 2011-04-21 01:21:27 -0400 | [diff] [blame] | 333 | // Internals |
| 334 | // -------------------------------------------------------------------- |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 335 | |
Pascal Kriete | ae7b3f9 | 2011-04-21 01:21:27 -0400 | [diff] [blame] | 336 | /** |
| 337 | * Overwrite runBare |
| 338 | * |
| 339 | * PHPUnit instantiates the test classes before |
| 340 | * running them individually. So right before a test |
| 341 | * runs we set our instance. Normally this step would |
| 342 | * happen in setUp, but someone is bound to forget to |
| 343 | * call the parent method and debugging this is no fun. |
| 344 | */ |
| 345 | public function runBare() |
Pascal Kriete | fe372e3 | 2011-04-21 00:59:45 -0400 | [diff] [blame] | 346 | { |
Pascal Kriete | ae7b3f9 | 2011-04-21 01:21:27 -0400 | [diff] [blame] | 347 | self::$ci_test_instance = $this; |
| 348 | parent::runBare(); |
Pascal Kriete | fe372e3 | 2011-04-21 00:59:45 -0400 | [diff] [blame] | 349 | } |
Taufan Aditya | e1dc9ea | 2012-03-28 16:49:49 +0700 | [diff] [blame] | 350 | |
Pascal Kriete | fe372e3 | 2011-04-21 00:59:45 -0400 | [diff] [blame] | 351 | // -------------------------------------------------------------------- |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 352 | |
| 353 | public function helper($name) |
Pascal Kriete | ae7b3f9 | 2011-04-21 01:21:27 -0400 | [diff] [blame] | 354 | { |
dchill42 | 7ecc5cd | 2012-10-12 16:25:51 -0400 | [diff] [blame] | 355 | require_once(SYSTEM_PATH.'helpers/'.$name.'_helper.php'); |
| 356 | } |
| 357 | |
| 358 | // -------------------------------------------------------------------- |
| 359 | |
| 360 | public function lang($name) |
| 361 | { |
| 362 | require(SYSTEM_PATH.'language/english/'.$name.'_lang.php'); |
| 363 | return $lang; |
Pascal Kriete | fe372e3 | 2011-04-21 00:59:45 -0400 | [diff] [blame] | 364 | } |
Taufan Aditya | 8749bc7 | 2012-03-11 05:43:45 +0700 | [diff] [blame] | 365 | |
| 366 | // -------------------------------------------------------------------- |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 367 | |
Taufan Aditya | 8749bc7 | 2012-03-11 05:43:45 +0700 | [diff] [blame] | 368 | /** |
| 369 | * This overload is useful to create a stub, that need to have a specific method. |
| 370 | */ |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 371 | public function __call($method, $args) |
Taufan Aditya | 8749bc7 | 2012-03-11 05:43:45 +0700 | [diff] [blame] | 372 | { |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 373 | if ($this->{$method} instanceof Closure) |
Taufan Aditya | 8749bc7 | 2012-03-11 05:43:45 +0700 | [diff] [blame] | 374 | { |
| 375 | return call_user_func_array($this->{$method},$args); |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 376 | } |
| 377 | else |
Taufan Aditya | 8749bc7 | 2012-03-11 05:43:45 +0700 | [diff] [blame] | 378 | { |
| 379 | return parent::__call($method, $args); |
| 380 | } |
| 381 | } |
Pascal Kriete | 69c97a7 | 2011-04-20 21:44:54 -0400 | [diff] [blame] | 382 | |
Andrey Andreev | f243ce1 | 2012-06-09 23:34:21 +0300 | [diff] [blame] | 383 | } |