private function whenIListTheActions() { $this->app->actions->add('index', new ListActions($this->app->actions, $this->app->groups, $this->app->access, $this->app->parser)); $reader = new FakeParameterReader(); $crumbs = new BreadCrumbsTrail($reader, []); $resource = new ExecutionResource($this->app, $reader, $crumbs); $this->response = $resource->handleGet('index'); }
/** * Returns routes to connect to the given application. * * @param Application $app An Application instance * * @return ControllerCollection A ControllerCollection instance */ public function connect(Application $app) { /** @var ControllerCollection $controller */ $controller = $app['controllers_factory']; $controller->get('/', function (Request $request) { return $this->respond($request, function (BreadCrumbsTrail $crumbs, ParameterReader $reader) { $execution = new ExecutionResource($this->domin, $reader, $crumbs); return $execution->handleGet(null); }); }); $controller->get('/{action}', function (Request $request, $action) { return $this->respond($request, function (BreadCrumbsTrail $crumbs, ParameterReader $reader) use($action, $request) { $execution = new ExecutionResource($this->domin, $reader, $crumbs); return $execution->handleGet($action, $request->get(ExecutionResource::TOKEN_ARG)); }); }); $controller->post('/{action}', function (Request $request, $action) { return $this->respond($request, function (BreadCrumbsTrail $crumbs, ParameterReader $reader) use($action, $request) { $execution = new ExecutionResource($this->domin, $reader, $crumbs); return $execution->handlePost($action, $request->get(ExecutionResource::TOKEN_ARG)); }); }); return $controller; }
private function whenIExecute_With($action, $parameters) { $reader = new FakeParameterReader($parameters); $this->crumbs = new BreadCrumbsTrail($reader, $this->crumbSource); $resource = new ExecutionResource($this->app, $reader, $this->crumbs); $this->response = $resource->handleGet($action); }
private function whenIExecute_With($id, $parameters) { $this->app->prepare(); $reader = new FakeParameterReader($parameters); $execution = new ExecutionResource($this->app, $reader, new BreadCrumbsTrail($reader, [])); $this->response = $execution->handleGet($id); }