function CoderReviewUpgrade7xTest::testNode7x in Coder 7        
                          
                  
                        Same name and namespace in other branches
- 7.2 coder_review/tests/coder_review_7x.test \CoderReviewUpgrade7xTest::testNode7x()
File
 
   - coder_review/tests/coder_review_7x.test, line 556
Class
  
  - CoderReviewUpgrade7xTest 
Code
function testNode7x() {
  
  $this
    ->assertCoderReviewFail('  db_query("SELECT * FROM {node_revisions}");');
  
  $this
    ->assertCoderReviewFail("  function mymodule_link('node', \$node, \$teaser) {\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_link('taxonomy terms', \$node, \$teaser) {\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_link(\$type, \$node, \$teaser) {\n}");
  $this
    ->assertCoderReviewPass("  function mymodule_link(\$type, \$comment, \$teaser) {\n}");
  $this
    ->assertCoderReviewPass("  function mymodule_link('comment', \$comment, \$teaser) {\n}");
  
  $this
    ->assertCoderReviewFail('  node_load($param);');
  $this
    ->assertCoderReviewFail('  node_load($param, $vid);');
  $this
    ->assertCoderReviewFail('  node_load(array("nid" => 1), $vid);');
  $this
    ->assertCoderReviewPass('  node_load($nid);');
  $this
    ->assertCoderReviewPass('  node_load($nid, $vid);');
  $this
    ->assertCoderReviewPass('  node_load($nid, $vid, TRUE);');
  $this
    ->assertCoderReviewPass('  node_load(123);');
  
  $this
    ->assertCoderReviewFail("  function mymodule_node_info() {\n  return array('blog' => array('name' => t('Blog entry'), 'module' => 'blog'));\n}");
  $this
    ->assertCoderReviewPass("  function mymodule_node_info() {\n  return array('blog' => array('name' => t('Blog entry'), 'base' => 'blog'));\n}");
  $this
    ->assertCoderReviewPass("  function mymodule_node_info() {\n  return array('blog' => array('name' => t('Blog entry, module'), 'base' => 'blog'));\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_node_info() {\n  return array('blog' => array('name' => t('Blog entry'), 'base' => 'node'));\n}");
  $this
    ->assertCoderReviewPass("  function mymodule_node_info() {\n  return array('blog' => array('name' => t('Blog entry'), 'base' => 'node_content'));\n}");
  
  $this
    ->assertCoderReviewFail("  function mymodule_nodeapi(&\$node, \$op, \$teaser, \$page) {\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_nodeapi(&\$node, \$teaser, \$page) {\n  if (\$op == 'list') {\n  }\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_nodeapi(&\$node, \$teaser, \$page) {\n  switch (\$op) {\n  case 'list':\n  }\n}");
  
  $this
    ->assertCoderReviewPass('  module_invoke_all("node_" . $hook, $node);');
  $this
    ->assertCoderReviewFail('  node_invoke_nodeapi($node, $hook);');
  
  $this
    ->assertCoderReviewFail('  node_get_types($op);');
  $this
    ->assertCoderReviewFail('  node_get_types(\'types\');');
  
  $this
    ->assertCoderReviewFail('  $build_mode = NODE_BUILD_PREVIEW;');
  $this
    ->assertCoderReviewFail('  $node->build_mode = 2;');
  
  $this
    ->assertCoderReviewFail("  function mymodule_nodeapi_foo(&\$node, \$teaser, \$page)");
  $this
    ->assertCoderReviewPass("  function mymodule_node_foo(&\$node, \$teaser, \$page)");
}