You are here

function CoderUpgrade6xTest::testUpgrade6xFAPI in Coder 6.2

Same name and namespace in other branches
  1. 6 tests/coder_6x.test \CoderUpgrade6xTest::testUpgrade6xFAPI()

File

tests/coder_6x.test, line 55

Class

CoderUpgrade6xTest

Code

function testUpgrade6xFAPI() {
  $this
    ->assertCoderFail('  $form[\'#base\'] = \'http://example.com\';');
  $this
    ->assertCoderFail('  \'#base\' => \'my_shared_form_id\',');
  $this
    ->assertCoderFail('  $form[\'#multistep\'] = TRUE;');
  $this
    ->assertCoderFail('  \'#multistep\' => TRUE,');
  $this
    ->assertCoderFail('  $form[\'#DANGEROUS_SKIP_CHECK\'] = TRUE;');
  $this
    ->assertCoderFail('  \'#DANGEROUS_SKIP_CHECK\' => TRUE,');
  $this
    ->assertCoderPass('  $form[\'#pre_render\'][] = \'my_render_function\';');
  $this
    ->assertCoderFail('  $form[\'#pre_render\'][\'my_render_function\'] = array();');
  $this
    ->assertCoderFail('  $form[\'#submit\'][\'my_submit_function\'] = array($param1, $param2);');
  $this
    ->assertCoderFail('  $form[\'#submit\'][\'my_validate_function\'] = array();');
  $this
    ->assertCoderFail('  $form[\'#validate\'][\'my_custom_validate\'] = array();');
  $this
    ->assertCoderPass('  $form[\'#validate\'][] = \'my_custom_validate\';');
  $this
    ->assertCoderFail("  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
    ->assertCoderPass("  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
    ->assertCoderFail('  $form[\'abc\'] = array("#value" => t("Submit"));');
}