Skip to content

Commit 81df65d

Browse files
committed
Fixes gentlero#2 : Toggle spam on a changeset comment
1 parent 795585c commit 81df65d

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

lib/Bitbucket/API/Repositories/Changesets/Comments.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,21 @@ public function update($account, $repo, $node, $commentID, $content, array $opti
113113
array_merge(array('content' => $content), $options)
114114
);
115115
}
116+
117+
/**
118+
* Toggle spam flag on an existing changeset comment
119+
*
120+
* @access public
121+
* @param string $account The team or individual account owning the repo.
122+
* @param string $repo The repo identifier.
123+
* @param string $node The raw_node changeset identifier.
124+
* @param int $commentID The comment identifier.
125+
* @return MessageInterface
126+
*/
127+
public function spam($account, $repo, $node, $commentID)
128+
{
129+
return $this->requestPut(
130+
sprintf('repositories/%s/%s/changesets/%s/comments/spam/%d', $account, $repo, $node, $commentID)
131+
);
132+
}
116133
}

test/Bitbucket/Tests/API/Repositories/Changesets/CommentsTest.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,17 @@ public function testUpdateCommentSuccess()
6464
/** @var $comments \Bitbucket\API\Repositories\Changesets\Comments */
6565
$comments->update('gentle', 'eof', 'aea95f1', 3, 'edited comment');
6666
}
67-
}
67+
68+
public function testMarkCommentAsSpamSuccess()
69+
{
70+
$endpoint = 'repositories/gentle/eof/changesets/aea95f1/comments/spam/3';
71+
72+
$comments = $this->getApiMock('Bitbucket\API\Repositories\Changesets\Comments');
73+
$comments->expects($this->any())
74+
->method('requestPut')
75+
->with($endpoint);
76+
77+
/** @var $comments \Bitbucket\API\Repositories\Changesets\Comments */
78+
$comments->spam('gentle', 'eof', 'aea95f1', 3);
79+
}
80+
}

0 commit comments

Comments
 (0)