stable

Clone or download

Read-only

refactor: extract POSTHandler with unit tests

No functional change expected when creating a new inline comment through the REST API. Notes: - Ideally, the POSTHandler should also do the validation: checking the file exists, valid position, valid parent id, etc. Since my main goal here is to build a correct comment representation, I have left these out. Having a POSTHandler with unit tests that "just creates" the comment and adds default values is still better than before. - This also renames and changes the way to compute thread colors, so that we can use interfaces and stubs instead of mocks. Since we only need the number of comments, the DAO no longer returns an array to be counted but the number directly. part of story #32316 Update comments Change-Id: I1fdf24ead26c42866f2dee9187d5f2c190190d01

Modified Files

Name
A plugins/pullrequest/include/PullRequest/Comment/CountThreads.php +29 −0 Go to diff View file
M plugins/pullrequest/include/PullRequest/Comment/Dao.php +12 −0 Go to diff View file
M plugins/pullrequest/include/PullRequest/Comment/ParentCommentSearcher.php +1 −0 Go to diff View file
M plugins/pullrequest/include/PullRequest/Comment/ThreadCommentDao.php +4 −3 Go to diff View file
M plugins/pullrequest/include/PullRequest/InlineComment/Dao.php +16 −0 Go to diff View file
M plugins/pullrequest/include/PullRequest/InlineComment/InlineCommentCreator.php +8 −34 Go to diff View file
M plugins/pullrequest/include/PullRequest/REST/v1/Comment/ThreadCommentColorRetriever.php +9 −6 Go to diff View file
A plugins/pullrequest/include/PullRequest/REST/v1/InlineComment/POSTHandler.php +107 −0 Go to diff View file
M plugins/pullrequest/include/PullRequest/REST/v1/PullRequestInlineCommentRepresentation.php +4 −34 Go to diff View file
M plugins/pullrequest/include/PullRequest/REST/v1/PullRequestsResource.php +18 −51 Go to diff View file
M plugins/pullrequest/tests/integration/Comment/ThreadCommentDaoTest.php +6 −6 Go to diff View file
M plugins/pullrequest/tests/unit/InlineComment/InlineCommentCreatorTest.php +29 −67 Go to diff View file
M plugins/pullrequest/tests/unit/REST/v1/Comment/ThreadCommentColorRetrieverTest.php +22 −28 Go to diff View file
A plugins/pullrequest/tests/unit/REST/v1/InlineComment/POSTHandlerTest.php +156 −0 Go to diff View file
M plugins/pullrequest/tests/unit/Tests/Builders/NewInlineCommentTestBuilder.php +6 −0 Go to diff View file
A plugins/pullrequest/tests/unit/Tests/Stub/CountThreadsStub.php +46 −0 Go to diff View file
A plugins/pullrequest/tests/unit/Tests/Stub/ParentCommentSearcherStub.php +48 −0 Go to diff View file
A plugins/pullrequest/tests/unit/Tests/Stub/ThreadColorUpdaterStub.php +47 −0 Go to diff View file