1 form.test FormStateValuesCleanAdvancedTestCase::testFormStateValuesCleanAdvanced()

Tests form_state_values_clean().

File

core/modules/simpletest/tests/form.test, line 1690
Unit tests for the Backdrop Form API.

Class

FormStateValuesCleanAdvancedTestCase
Tests $form_state clearance with form elements having buttons.

Code

function testFormStateValuesCleanAdvanced() {

  // Get an image for uploading.
  $image_files = $this->backdropGetTestFiles('image');
  $this->image = current($image_files);

  // Check if the physical file is there.
  $this->assertTrue(is_file($this->image->uri), "The image file we're going to upload exists.");

  // "Browse" for the desired file.
  $edit = array('files[image]' => backdrop_realpath($this->image->uri));

  // Post the form.
  $this->backdropPost('form_test/form-state-values-clean-advanced', $edit, t('Submit'));

  // Expecting a 200 HTTP code.
  $this->assertResponse(200, 'Received a 200 response for posted test file.');
  $this->assertRaw(t('You WIN!'), 'Found the success message.');
}