stable

Clone or download

Read-only

refactor: use neverthrow to retrieve repository pull_requests

part of story #35821 Pull request new home page - Filter on Authors This refactoring is needed to: - Have a better management of errors that can occur during the retrieval of the pull-requests inside a given repository - Have unit tests on this part of the code (currently none) - Prepare the backend to handle several search criterion, as they will be cumulative. What has been done: - The code dealing with pull-request's retrieval has been extracted in a dedicated GETHandler class, so it can be unit tested more easily. - The error management is dealt with using neverthrow (query parsing + pr retrieval) - Missing unit tests have been added What to expect: - filter using `{"status": "open"}` --> Only the open pull-requests are returned - filter using `{"status": "closed"}` --> Only the closed pull-requests are returned - filter using `{"status": "unknown"}` --> You get an error 400 saying that the status value is wrong - filter using `{"something": "stuff"}` --> You get an error 400 syaing that the query is malformed - filter using `{}` --> All the pull-requests are returned - filter without specifying any query --> All the pull-requests are returned Change-Id: I99df153e949baec3529735829c2931f21297377d

Modified Files

Name
R plugins/pullrequest/include/PullRequest/Criterion/StatusOpen.php Go to diff View file
M plugins/git/include/Git/Gitolite/GitoliteAccessURLGenerator.php +1 −1 Go to diff View file
R plugins/pullrequest/include/PullRequest/Criterion/StatusAll.php Go to diff View file
R plugins/pullrequest/include/PullRequest/Criterion/StatusClosed.php Go to diff View file
A plugins/pullrequest/include/PullRequest/Criterion/SearchCriteria.php +49 −0 Go to diff View file
R plugins/pullrequest/include/PullRequest/Criterion/ISearchOnStatus.php Go to diff View file
A plugins/pullrequest/include/PullRequest/Criterion/StatusCriterion.php +41 −0 Go to diff View file
M plugins/pullrequest/include/PullRequest/Dao.php +35 −19 Go to diff View file
R plugins/pullrequest/include/PullRequest/Exception/MalformedQueryParameterException.php Go to diff View file
M plugins/pullrequest/include/PullRequest/REST/v1/FaultMapper.php +3 −0 Go to diff View file
M plugins/pullrequest/include/PullRequest/REST/v1/GitRepositoryReference.php +2 −8 Go to diff View file
A plugins/pullrequest/include/PullRequest/REST/v1/PullRequestAuthorNotFoundFault.php +43 −0 Go to diff View file
M plugins/pullrequest/include/PullRequest/REST/v1/PullRequestMinimalRepresentation.php +2 −5 Go to diff View file
D plugins/pullrequest/include/PullRequest/REST/v1/QueryToCriterionConverter.php +0 −62 Go to diff View file
A plugins/pullrequest/include/PullRequest/REST/v1/RepositoryPullRequests/GETHandler.php +121 −0 Go to diff View file
A plugins/pullrequest/include/PullRequest/REST/v1/RepositoryPullRequests/QueryToSearchCriteriaConverter.php +76 −0 Go to diff View file
M plugins/pullrequest/include/PullRequest/REST/v1/RepositoryResource.php +53 −112 Go to diff View file
M plugins/pullrequest/include/PullRequest/Reviewer/RetrieveReviewers.php +18 −15 Go to diff View file
M plugins/pullrequest/include/PullRequest/Reviewer/ReviewerDAO.php +2 −2 Go to diff View file
M plugins/pullrequest/include/PullRequest/Reviewer/ReviewerRetriever.php +3 −3 Go to diff View file
A plugins/pullrequest/include/PullRequest/Reviewer/SearchReviewers.php +28 −0 Go to diff View file
A plugins/pullrequest/include/PullRequest/SearchPaginatedPullRequests.php +30 −0 Go to diff View file
R plugins/pullrequest/tests/unit/REST/FaultMapperTest.php Go to diff View file
M plugins/pullrequest/tests/unit/REST/v1/PullRequestRepresentationFactoryTest.php +2 −2 Go to diff View file
A plugins/pullrequest/tests/unit/REST/v1/RepositoryPullRequests/GETHandlerTest.php +147 −0 Go to diff View file
A plugins/pullrequest/tests/unit/REST/v1/RepositoryPullRequests/QueryToSearchCriteriaConverterTest.php +86 −0 Go to diff View file
A plugins/pullrequest/tests/unit/Tests/Stub/GenerateGitoliteAccessURLStub.php +39 −0 Go to diff View file
M plugins/pullrequest/tests/unit/Tests/Stub/RetrieveReviewersStub.php +25 −55 Go to diff View file
A plugins/pullrequest/tests/unit/Tests/Stub/SearchPaginatedPullRequestsStub.php +76 −0 Go to diff View file
A plugins/pullrequest/tests/unit/Tests/Stub/SearchReviewersStub.php +78 −0 Go to diff View file