/** * */ function test_bind_exception() { $app = new App(); Context::bind($app); $this->setExpectedException(\RuntimeException::class, 'Service already exists'); Context::bind($app); }
/** * */ function test_trigger() { $app = new App(['events' => ['foo' => [function () { return 'bar'; }]]]); Context::bind($app); $this->assertEquals('bar', ServiceFacade::trigger('foo')); }
/** * @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); }