You are here

function CoderReviewUpgrade6xTest::testUpgrade6x in Coder 7.2

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

???

File

coder_review/tests/coder_review_6x.test, line 36

Class

CoderReviewUpgrade6xTest
???

Code

function testUpgrade6x() {
  $this
    ->assertCoderReviewFail('  function my_module_forms($args) {');
  $this
    ->assertCoderReviewPass('  function my_module_forms($form_id, $args) {');
  $this
    ->assertCoderReviewPass('  drupal_retrieve_form(\'testform\', $form_state);');
  $this
    ->assertCoderReviewFail('  drupal_retrieve_form(\'testform\');');
  $this
    ->assertCoderReviewPass('  drupal_retrieve_form($form_id, $form_state);');
  $this
    ->assertCoderReviewFail('  drupal_retrieve_form($form_id);');
  $this
    ->assertCoderReviewPass('  form_set_value($element, \'value\', $form_state);');
  $this
    ->assertCoderReviewFail('  form_set_value($element, \'value\');');
  $this
    ->assertCoderReviewFail('  function myform_prerender($form_id, $form) {');
  $this
    ->assertCoderReviewPass('  function myform_prerender($form) {');
  $this
    ->assertCoderReviewFail('  function myform_validate($form_id, $form_values) {');
  $this
    ->assertCoderReviewFail('  function myform_validate($form, $form_state) {');
  $this
    ->assertCoderReviewPass('  function myform_validate($form, $form_state);');
  $this
    ->assertCoderReviewPass('  function myform_validate($form, &$form_state) {');
  $this
    ->assertCoderReviewFail('  function myform_submit($form_id, $form_values) {');
  $this
    ->assertCoderReviewFail('  function myform_submit($form, $form_state) {');
  $this
    ->assertCoderReviewPass('  function myform_submit($form, &$form_state) {');
  $this
    ->assertCoderReviewFail("  function myform_submit(\$form, &\$form_state) {\n  return \$foo;\n}");
  $this
    ->assertCoderReviewFail("  function myform_submit(\$form, &\$form_state) {\n  return 'my/path';\n}");
  $this
    ->assertCoderReviewFail("  function myform_submit(\$form, &\$form_state) {\n \$form['#submit']['newsubmit'] = array();\n}");
  $this
    ->assertCoderReviewPass("  function myform_submit(\$form, &\$form_state) {\n \$form['#submit'][] = 'newsubmit';\n}");
  $this
    ->assertCoderReviewFail('  function mymodule_form_alter($form_id, &$form) {');
  $this
    ->assertCoderReviewPass('  function mymodule_form_alter(&$form, $form_state, $form_id) {');
  $this
    ->assertCoderReviewFail('  $op = $form_values[\'op\'];');
  $this
    ->assertCoderReviewFail('  $op = $form[\'op\'];');
  $this
    ->assertCoderReviewFail("  function myform_submit() {\n  \$a = \$form_values['foo'];\n}");
  $this
    ->assertCoderReviewFail("  function myform_submit() {\n  \$a = \$form['foo'];\n}");
  $this
    ->assertCoderReviewFail("  function myform_validate() {\n  \$a = \$form_values['foo'];\n}");
  $this
    ->assertCoderReviewFail("  function myform_validate() {\n  \$a = \$form['foo'];\n}");
}