Exemplo n.º 1
0
 /**
  *
  */
 function test_bind_exception()
 {
     $app = new App();
     Context::bind($app);
     $this->setExpectedException(\RuntimeException::class, 'Service already exists');
     Context::bind($app);
 }
Exemplo n.º 2
0
 /**
  *
  */
 function test_trigger()
 {
     $app = new App(['events' => ['foo' => [function () {
         return 'bar';
     }]]]);
     Context::bind($app);
     $this->assertEquals('bar', ServiceFacade::trigger('foo'));
 }
Exemplo n.º 3
0
 /**
  * @param Request $request
  * @param Response $response
  * @param callable $next
  * @return Response
  */
 function __invoke(Request $request, Response $response, callable $next)
 {
     _Context::bind($this->service());
     return $next($request, $response);
 }