You are here

function CoderReviewUpgrade6xTest::testUpgrade6xFAPI in Coder 7.2

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

???

File

coder_review/tests/coder_review_6x.test, line 71

Class

CoderReviewUpgrade6xTest
???

Code

function testUpgrade6xFAPI() {
  $this
    ->assertCoderReviewFail('  $form[\'#base\'] = \'http://example.com\';');
  $this
    ->assertCoderReviewFail('  \'#base\' => \'my_shared_form_id\',');
  $this
    ->assertCoderReviewFail('  $form[\'#multistep\'] = TRUE;');
  $this
    ->assertCoderReviewFail('  \'#multistep\' => TRUE,');
  $this
    ->assertCoderReviewFail('  $form[\'#DANGEROUS_SKIP_CHECK\'] = TRUE;');
  $this
    ->assertCoderReviewFail('  \'#DANGEROUS_SKIP_CHECK\' => TRUE,');
  $this
    ->assertCoderReviewPass('  $form[\'#pre_render\'][] = \'my_render_function\';');
  $this
    ->assertCoderReviewFail('  $form[\'#pre_render\'][\'my_render_function\'] = array();');
  $this
    ->assertCoderReviewFail('  $form[\'#submit\'][\'my_submit_function\'] = array($param1, $param2);');
  $this
    ->assertCoderReviewFail('  $form[\'#submit\'][\'my_validate_function\'] = array();');
  $this
    ->assertCoderReviewFail('  $form[\'#validate\'][\'my_custom_validate\'] = array();');
  $this
    ->assertCoderReviewPass('  $form[\'#validate\'][] = \'my_custom_validate\';');
  $this
    ->assertCoderReviewFail("  function mymodule_elements() {\n  return array('my_custom_form_element' => array(\n    '#custom_property' => 'foo',\n    '#validate' => array('my_element_validate' => array()),\n  )\n);\n}");
  $this
    ->assertCoderReviewPass("  function mymodule_elements() {\n  return array('my_custom_form_element' => array(\n    '#custom_property' => 'foo',\n    '#element_validate' => array('my_element_validate'),\n  );\n);\n}");
  $this
    ->assertCoderReviewFail('  $form[\'abc\'] = array("#value" => t("Submit"));');
}