public function createWorkspaceAction(SessionManager $repository, Request $request)
 {
     if (($name = $request->request->get('name')) === null) {
         $this->app->abort(400, 'Missing parameters');
     }
     $srcWorkspace = $request->request->get('srcWorkspace', null);
     $currentWorkspace = $repository->getWorkspaceManager();
     $currentWorkspace->createWorkspace($name, $srcWorkspace);
     return $this->app->redirect($this->app->path('workspace', ['repository' => $repository->getName(), 'workspace' => $name]), 201);
 }
 public function addNodeAction(SessionManager $repository, $workspace, $path, Request $request)
 {
     if (!$repository->nodeExists($path)) {
         throw new ResourceNotFoundException('Unknown node');
     }
     $currentNode = $repository->getNode($path);
     if (($relPath = $request->request->get('relPath')) === null) {
         $this->app->abort(400, 'Missing parameters');
     }
     $primaryNodeTypeName = $request->request->get('primaryNodeTypeName', null);
     $currentNode->addNode($relPath, $primaryNodeTypeName);
     return $this->app->redirect($this->app->path('node', ['repository' => $repository->getName(), 'workspace' => $workspace, 'path' => $currentNode->getPath() === '/' ? $currentNode->getPath() . $relPath : $currentNode->getPath() . '/' . $relPath]), 201);
 }
Esempio n. 3
0
 public function testItShouldCallGetName()
 {
     $session = $this->mock('\\PHPCRAPI\\PHPCR\\Session')->getName($this->once())->new($this->repository, 'default');
     $manager = new SessionManager($session);
     $manager->getName();
 }