public static function mod($name, $callbacks = array()) { $m = new Ernie_Module($name); self::$_currentMod = $m; self::$_mods[$name] = $m; foreach ($callbacks as $n => $c) { $m->fun($n, $c); } }
public function testExpose() { Mock::generate('MyClass', 'MyMock'); $m = new MyMock(); Ernie::expose('test', $m); $m->expectCallCount('a', 1); $m->expectCallCount('b', 1); Ernie::dispatch('test', 'a', array()); Ernie::dispatch('test', 'b', array()); }
<?php require_once 'classes/Bert.php'; require_once 'classes/Ernie.php'; Ernie::mod('calculator', array('add' => function ($a, $b) { return $a + $b; }, 'subtract' => function ($a, $b) { return $a - $b; })); Ernie::start();