public function updateNodeAction(SessionManager $repository, $workspace, $path, Request $request) { if (!$repository->nodeExists($path)) { throw new ResourceNotFoundException('Unknown node'); } $currentNode = $repository->getNode($path); if (($method = $request->request->get('method')) === null) { $this->app->abort(400, 'Missing parameters'); } switch ($method) { default: throw new NotSupportedOperationException('Unknown method'); break; case 'rename': if (!($newName = $request->request->get('newName'))) { $this->app->abort(400, 'Missing parameters'); } $currentNode->rename($newName); break; case 'move': if (!($destAbsPath = $request->request->get('destAbsPath'))) { $this->app->abort(400, 'Missing parameters'); } $repository->move($path, $destAbsPath); break; } return $this->app->redirect($this->app->path('node', ['repository' => $repository->getName(), 'workspace' => $workspace, 'path' => $currentNode->getPath()]), 201); }
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'); }