Ejemplo n.º 1
0
 /**
  * Get available Workflows for a document.
  *
  * @param Request $request
  * @param string  $subject
  *
  * @return Response
  *
  * @throws AccessDeniedException If getting workflows for this document is
  *                               not allowed by the access checker.
  */
 public function workflowsAction(Request $request, $subject)
 {
     if (!$this->accessChecker->check($request)) {
         throw new AccessDeniedException();
     }
     $result = $this->restHandler->getWorkflows($subject);
     $view = View::create($result)->setFormat('json');
     return $this->viewHandler->handle($view, $request);
 }
Ejemplo n.º 2
0
 public function test_get_registerWorkflow()
 {
     $workflow = new MockWorkflow();
     $mapper = $this->getMock('Midgard\\CreatePHP\\RdfMapperInterface');
     $restHandler = new RestService($mapper);
     $restHandler->registerWorkflow('mock', $workflow);
     $expected = array(array('name' => "mockbutton", 'label' => 'Mock Label', 'action' => array('type' => "backbone_destroy"), 'type' => "button"));
     $this->assertEquals($expected, $restHandler->getWorkflows('test1'));
 }