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); }
public function deleteWorkspaceAction(SessionManager $repository, $workspace, Request $request) { $currentWorkspace = $repository->getWorkspaceManager(); $currentWorkspace->deleteWorkspace($workspace); return $this->buildResponse('Workspace deleted', 0); }
public function testItShouldCallMove() { $session = $this->mock('\\PHPCRAPI\\PHPCR\\Session')->save($this->once())->move($this->once())->new($this->repository, 'default'); $manager = new SessionManager($session); $manager->move('/src', '/dest'); }