You are here

function ServicesResourceCommentTests::testCommentCountAll in Services 7.3

Same name and namespace in other branches
  1. 6.3 tests/functional/ServicesResourceCommentTests.test \ServicesResourceCommentTests::testCommentCountAll()

Test countAll method.

File

tests/functional/ServicesResourceCommentTests.test, line 328
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 testCommentCountAll() {
  $path = $this->endpoint->path;

  // Generate comments.
  $settings = array(
    'comment' => 1,
  );
  $node = $this
    ->drupalCreateNode($settings);
  for ($i = 0; $i < 5; $i++) {
    $comment = (object) $this
      ->getCommentValues($node->nid);
    comment_save($comment);
  }
  $response = $this
    ->servicesPost($path . '/comment/countAll', array(
    'nid' => $node->nid,
  ));
  $this
    ->assertEqual($response['body'], 5, 'Counted number of comments properly.', 'CommentResource: countAll');
}