function ServicesResourceCommentTests::testCommentUpdateLegacy in Services 6.3
Same name and namespace in other branches
- 7.3 tests/functional/ServicesResourceCommentTests.test \ServicesResourceCommentTests::testCommentUpdateLegacy()
Test update method (Legacy).
TODO: To be removed in future version.
See also
http://drupal.org/node/1083242
File
- tests/
functional/ ServicesResourceCommentTests.test, line 209
Class
- ServicesResourceCommentTests
- Run test cases for the endpoint with no authentication turned on.
Code
function testCommentUpdateLegacy() {
$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;
$comment_update = $comment;
$comment_update['subject'] = $this
->randomString();
$comment_update['comment'] = $this
->randomString();
$response = $this
->servicesPut($path . '/comment/' . $cid, array(
'data' => $comment_update,
));
$comment_load = (array) _comment_load($cid);
$comment_intersect = array_intersect_assoc($comment_load, $comment_update);
$this
->assertEqual($comment_update, $comment_intersect, t('Comment updated properly.'), 'CommentResource: Update (legacy)');
}