public function convert($repository, Request $request) { if (is_null($repository)) { return null; } $workspace = $request->attributes->has('workspace') ? $request->attributes->get('workspace') : null; try { $repositoryManager = new RepositoryManager($this->app['phpcr_api.repository_loader']->getRepositories()->get($repository)); $sessionManager = $repositoryManager->getSessionManager($workspace); return $sessionManager; } catch (CollectionUnknownKeyException $e) { throw new ResourceNotFoundException('The repository is unknown'); } }
public function testItShouldCallGetName() { $repository = $this->mock('\\PHPCRAPI\\PHPCR\\Repository')->getName($this->once())->new(); $manager = new RepositoryManager($repository); $manager->getName(); }