You are here

function CoderReviewUpgrade6xTest::testUpgrade6xMenu in Coder 7

Same name and namespace in other branches
  1. 7.2 coder_review/tests/coder_review_6x.test \CoderReviewUpgrade6xTest::testUpgrade6xMenu()

File

coder_review/tests/coder_review_6x.test, line 72

Class

CoderReviewUpgrade6xTest

Code

function testUpgrade6xMenu() {
  $this
    ->assertCoderReviewPass("  function mymodule_menu() {\n  \$items = array();\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_menu() {\n  \$items[] = array();\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_menu() {\n  if (\$may_cache) {\n  }\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_menu() {\n  \$items['test'] = array('title' => t('my title'));\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_menu() {\n  \$items['test'] = array('description' => t('my description'));\n}");
  $this
    ->assertCoderReviewPass("  function mymodule_menu() {\n  \$items['test'] = array('title' => 'my title');\n}");
  $this
    ->assertCoderReviewPass("  function mymodule_menu() {\n  \$items['test'] = array('description' => 'my description');\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_menu() {\n  \$items['node/add/foo'] = array();\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_menu() {\n  for (\$i=0; \$i<1; \$i++) {\n  }\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_menu() {\n  foreach (\$a as \$b) {\n  }\n}");
  $this
    ->assertCoderReviewFail("  function mymodule_menu() {\n  while (\$a > \$b) {\n  }\n}");
  $this
    ->assertCoderReviewPass("  function not_a_menu_hook() {\n  \$items[] = array();\n}");
  $this
    ->assertCoderReviewFail('  if ($node = node_load(arg(1))) {');
  $this
    ->assertCoderReviewFail('  if ($user = user_load(arg(1))) {');
  $this
    ->assertCoderReviewFail('  if ($menu = menu_load(arg(1))) {');
  $this
    ->assertCoderReviewFail('  if ($menu_link = menu_link_load(arg(1))) {');
  $this
    ->assertCoderReviewFail('  if ($vocab = taxonomy_vocabulary_load(arg(1))) {');
  $this
    ->assertCoderReviewFail('  if ($contact = contact_load(arg(1))) {');
  $this
    ->assertCoderReviewFail('  if ($format = filter_format_load(arg(1))) {');
  $this
    ->assertCoderReviewFail('  if ($term = forum_term_load(arg(1))) {');
  $this
    ->assertCoderReviewFail('  if ($feed = aggregator_feed_load(arg(1))) {');
  $this
    ->assertCoderReviewFail('  if ($category = aggregator_category_load(arg(1))) {');
  $this
    ->assertCoderReviewFail('  menu_set_location();');
}