function ServicesResourceCommentTests::testCommentDelete in Services 7.3
Same name and namespace in other branches
- 6.3 tests/functional/ServicesResourceCommentTests.test \ServicesResourceCommentTests::testCommentDelete()
Test delete method.
File
- tests/
functional/ ServicesResourceCommentTests.test, line 299 - Call the endpoint tests when no authentication is being used.
Class
- ServicesResourceCommentTests
- Run test cases for the endpoint with no authentication turned on.
Code
function testCommentDelete() {
$path = $this->endpoint->path;
$this->privilegedUser = $this
->drupalCreateUser(array(
'administer services',
'administer comments',
));
$this
->drupalLogin($this->privilegedUser);
// Create node with commenting.
$node = $this
->drupalCreateNode();
$comment_args = $this
->getCommentValues($node->nid);
$comment = (object) $comment_args;
comment_save($comment);
$cid = $comment->cid;
$comment_args['cid'] = $cid;
$response = $this
->servicesDelete($path . '/comment/' . $cid);
$comment_load = comment_load($cid);
$this
->assertTrue(empty($comment_load), 'Comment deleted properly.', 'CommentResource: Delete');
}