function testMapOverridesRegister() { $this->app->register('reg5', 'User'); $user = $this->app->reg5(); $this->assertTrue(is_object($user)); $this->app->map('reg5', function () { return 123; }); $user = $this->app->reg5(); $this->assertEquals(123, $user); }
function testFilterChaining() { $this->app->map('bye', function ($name) { return "Bye, {$name}!"; }); $this->app->before('bye', function (&$params, &$output) { $params[0] = 'Bob'; }); $this->app->before('bye', function (&$params, &$output) { $params[0] = 'Fred'; return false; }); $this->app->before('bye', function (&$params, &$output) { $params[0] = 'Ted'; }); $result = $this->app->bye('Joe'); $this->assertEquals('Bye, Fred!', $result); }
function testStaticClassMethodMapping() { $this->app->map('map4', array('Hello', 'sayBye')); $result = $this->app->map4(); $this->assertEquals('goodbye', $result); }