You are here

public function FormElementTestCase::testWeightDefaultValue in Drupal 7

Tests Weight form element #default_value behavior.

File

modules/simpletest/tests/form.test, line 598
Unit tests for the Drupal Form API.

Class

FormElementTestCase
Tests building and processing of core form elements.

Code

public function testWeightDefaultValue() {
  $element = array(
    '#type' => 'weight',
    '#delta' => 10,
    '#default_value' => 15,
  );
  $element = form_process_weight($element);
  $this
    ->assertTrue(isset($element['#options'][$element['#default_value']]), 'Default value exists in #options list');
}