You are here

function CoderReviewUpgrade7xTest::testComments7x in Coder 7.2

Same name and namespace in other branches
  1. 7 coder_review/tests/coder_review_7x.test \CoderReviewUpgrade7xTest::testComments7x()

???

File

coder_review/tests/coder_review_7x.test, line 279

Class

CoderReviewUpgrade7xTest
???

Code

function testComments7x() {

  // N/A - http://drupal.org/node/224333#comment_load_multiple
  // N/A - http://drupal.org/node/224333#comment_save_refactor
  // N/A - http://drupal.org/node/224333#comment_presave_hook
  // http://drupal.org/node/224333#comment_load
  $this
    ->assertCoderReviewFail('  $comment = _comment_load($cid);');
  $this
    ->assertCoderReviewFail('  if (_comment_load($cid))');
  $this
    ->assertCoderReviewPass('  $comment = comment_load($cid);');
  $this
    ->assertCoderReviewPass('  if (comment_load($cid))');

  // Any menu items that are using the %_comment wildcard will need to change to %comment.
  $this
    ->assertCoderReviewFail("  function mymodule_menu() {\n\$items['foo/%_comment'] = array();\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_menu_alter() {\n\$items['foo/%_comment'] = array();\n}");
  $this
    ->assertCoderReviewPass("  function mymodule_menu() {\n\$items['foo/%comment'] = array();\n}");
  $this
    ->assertCoderReviewPass("  function mymodule_menu_alter() {\n\$items['foo/%comment'] = array();\n}");
  $this
    ->assertCoderReviewPass("  \$foo = 'foo/%_comment';");

  // http://drupal.org/node/224333#comment_status
  $this
    ->assertCoderReviewFail(' db_query(\'SELECT cid FROM {comments} WHERE status = 0\');');
  $this
    ->assertCoderReviewFail(' db_query(\'SELECT cid FROM {comments} WHERE status != 0\');');
  $this
    ->assertCoderReviewFail(' db_query(\'SELECT cid FROM {comments} WHERE status <> 0\');');
  $this
    ->assertCoderReviewPass(' db_query(\'SELECT cid FROM {comments} WHERE status = :status\', array(\':status\' => COMMENT_NOT_PUBLISHED));');
  $this
    ->assertCoderReviewPass(' db_query(\'SELECT cid FROM {my_comments} WHERE status = 0\');');

  // http://drupal.org/node/224333#comment_validate_removed
  $this
    ->assertCoderReviewFail('  comment_validate();');
  $this
    ->assertCoderReviewFail('  if (comment_validate())');

  // http://drupal.org/node/224333#comment_node_url
  $this
    ->assertCoderReviewFail('  comment_node_url();');
  $this
    ->assertCoderReviewFail('  if (comment_node_url())');
}