function ServicesResourceCommentTests::testCommentDelete in Services 6.3
Same name and namespace in other branches
- 7.3 tests/functional/ServicesResourceCommentTests.test \ServicesResourceCommentTests::testCommentDelete()
Test delete method.
File
- tests/
functional/ ServicesResourceCommentTests.test, line 244
Class
- ServicesResourceCommentTests
- Run test cases for the endpoint with no authentication turned on.
Code
function testCommentDelete() {
$path = $this->endpoint->path;
// Create node with commenting.
$settings = array(
'comment' => COMMENT_NODE_READ_WRITE,
);
$node = $this
->drupalCreateNode($settings);
$comment = array(
'cid' => NULL,
'uid' => $this->privileged_user->uid,
'nid' => $node->nid,
'subject' => $this
->randomString(),
'comment' => $this
->randomString(),
'format' => 1,
);
$cid = comment_save((array) $comment);
$comment['cid'] = $cid;
$response = $this
->servicesDelete($path . '/comment/' . $cid);
$comment_load = _comment_load($cid);
$this
->assertTrue(empty($comment_load), t('Comment deleted properly.'), 'CommentResource: Delete');
}