Révision b0dc3a2e
Ajouté par Julien Enselme il y a plus de 7 ans
drupal7/modules/simpletest/tests/form.test | ||
---|---|---|
994 | 994 |
$this->assertTrue(isset($errors['tableselect']), 'Option checker disallows invalid values for radio buttons.'); |
995 | 995 |
} |
996 | 996 |
|
997 |
/** |
|
998 |
* Test presence of ajax functionality |
|
999 |
*/ |
|
1000 |
function testAjax() { |
|
1001 |
$rows = array('row1', 'row2', 'row3'); |
|
1002 |
// Test checkboxes (#multiple == TRUE). |
|
1003 |
foreach ($rows as $row) { |
|
1004 |
$element = 'tableselect[' . $row . ']'; |
|
1005 |
$edit = array($element => TRUE); |
|
1006 |
$result = $this->drupalPostAJAX('form_test/tableselect/multiple-true', $edit, $element); |
|
1007 |
$this->assertFalse(empty($result), t('Ajax triggers on checkbox for @row.', array('@row' => $row))); |
|
1008 |
} |
|
1009 |
// Test radios (#multiple == FALSE). |
|
1010 |
$element = 'tableselect'; |
|
1011 |
foreach ($rows as $row) { |
|
1012 |
$edit = array($element => $row); |
|
1013 |
$result = $this->drupalPostAjax('form_test/tableselect/multiple-false', $edit, $element); |
|
1014 |
$this->assertFalse(empty($result), t('Ajax triggers on radio for @row.', array('@row' => $row))); |
|
1015 |
} |
|
1016 |
} |
|
997 | 1017 |
|
998 | 1018 |
/** |
999 | 1019 |
* Helper function for the option check test to submit a form while collecting errors. |
... | ... | |
2099 | 2119 |
$this->assertNoDuplicateIds('There are no duplicate IDs'); |
2100 | 2120 |
} |
2101 | 2121 |
} |
2122 |
|
|
2123 |
/** |
|
2124 |
* Tests for form textarea. |
|
2125 |
*/ |
|
2126 |
class FormTextareaTestCase extends DrupalUnitTestCase { |
|
2127 |
|
|
2128 |
public static function getInfo() { |
|
2129 |
return array( |
|
2130 |
'name' => 'Form textarea', |
|
2131 |
'description' => 'Tests form textarea related functions.', |
|
2132 |
'group' => 'Form API', |
|
2133 |
); |
|
2134 |
} |
|
2135 |
|
|
2136 |
/** |
|
2137 |
* Tests that textarea value is properly set. |
|
2138 |
*/ |
|
2139 |
public function testValueCallback() { |
|
2140 |
$element = array(); |
|
2141 |
$form_state = array(); |
|
2142 |
$test_cases = array( |
|
2143 |
array(NULL, FALSE), |
|
2144 |
array(NULL, NULL), |
|
2145 |
array('', array('test')), |
|
2146 |
array('test', 'test'), |
|
2147 |
array('123', 123), |
|
2148 |
); |
|
2149 |
foreach ($test_cases as $test_case) { |
|
2150 |
list($expected, $input) = $test_case; |
|
2151 |
$this->assertIdentical($expected, form_type_textarea_value($element, $input, $form_state)); |
|
2152 |
} |
|
2153 |
} |
|
2154 |
} |
Formats disponibles : Unified diff
Update to Drupal 7.52