Beispiel #1
0
 function testBeforeAndAfter()
 {
     $this->app->map('hello', function ($name) {
         return "Hello, {$name}!";
     });
     $this->app->before('hello', function (&$params, &$output) {
         // Manipulate the parameter
         $params[0] = 'Fred';
     });
     $this->app->after('hello', function (&$params, &$output) {
         // Manipulate the output
         $output .= " Have a nice day!";
     });
     $result = $this->app->hello('Bob');
     $this->assertEquals('Hello, Fred! Have a nice day!', $result);
 }