/** * Returns the detailed 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( * 0 => array( * 'path' => '/tags', * 'author => 169, * 'timestamp' => 1545265465, * 'message' => 'some commit message'), * 1 => array( * 'path' => '/tags', * 'author => 587, * 'timestamp' => 11545824, * 'message' => 'some other commit message'), * ).</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') * @param String $sort The type of sort wanted: ASC or DESC * * @return ArrayOfSvnPathDetails The detailed list of directories */ public function getSvnPathsWithLogDetails($sessionKey, $group_id, $path, $sort) { try { $data = array(); $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); $path_logs = $this->svn_repository_listing->getSvnPathsWithLogDetails($current_user, $project, $path, $sort); foreach ($path_logs as $path_log) { $data[] = $path_log->exportToSoap(); } return $data; } catch (Exception $e) { return new SoapFault((string) $e->getCode(), $e->getMessage()); } }
public function itReturnsAnEmptyArrayIfEmptyRepository() { $svnlook = mock('SVN_Svnlook'); $svn_repo_listing = new SVN_RepositoryListing($this->svn_perms_mgr, $svnlook, $this->user_manager); $content = array('/'); stub($svnlook)->getDirectoryListing($this->project, '/')->returns($content); $last_revision = $svn_repo_listing->getSvnPathsWithLogDetails($this->user, $this->project, '/', $this->order); $this->assertTrue(is_array($last_revision)); $this->assertCount($last_revision, 0); }