コード例 #1
0
ファイル: ListActionsSpec.php プロジェクト: rtens/domin
 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');
 }
コード例 #2
0
 /**
  * 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;
 }
コード例 #3
0
 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);
 }
コード例 #4
0
ファイル: ExecuteActionSpec.php プロジェクト: rtens/domin
 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);
 }