/** * Returns the content of a directory in Subversion according to user permissions * * <ul> * <li>If user cannot see the content it gets an empty array.</li> * <li>The returned content is relative (/project/tags) gives array("1.0", "2.0").</li> * </ul> * * Error codes: * * 3001, Invalid session (wrong $sessionKey) * * 3002, User do not have access to the project * * @param String $sessionKey Session key of the desired project admin * @param Integer $group_id ID of the project the subversion repository belongs to * @param String $path Path to the directory to list (eg. '/tags') * * @return ArrayOfString The list of directories */ public function getSvnPath($sessionKey, $group_id, $path) { try { $current_user = $this->soap_request_validator->continueSession($sessionKey); $project = $this->soap_request_validator->getProjectById($group_id, 'getSVNPath'); $this->soap_request_validator->assertUserCanAccessProject($current_user, $project); return $this->svn_repository_listing->getSvnPath($current_user, $project, $path); } catch (Exception $e) { return new SoapFault((string) $e->getCode(), $e->getMessage()); } }
public function itExecuteTheCommandOnTheSystem() { $user = mock('User'); $project = stub('Project')->getUnixName()->returns($this->project_name); $svn_path = '/tags'; $svn_repo_listing = TestHelper::getPartialMock('SVN_RepositoryListing', array('getDirectoryListing')); $svn_perms_mgr = stub('SVN_PermissionsManager')->userCanRead()->returns(true); $svn_repo_listing = new SVN_RepositoryListing($svn_perms_mgr); $tags = $svn_repo_listing->getSvnPath($user, $project, $svn_path); $tags = array_values($tags); $tags = sort($tags); $this->assertEqual($tags, array('1.0', '2.0')); }