1.20.x common.test | CommonBackdropArrayUnitTest::testSet() |
Tests setting nested array values.
File
- modules/
simpletest/ tests/ common.test, line 3026 - Tests for common.inc functionality.
Class
- CommonBackdropArrayUnitTest
- Tests the various backdrop_array_* helper functions.
Code
function testSet() {
$new_value = array(
'#value' => 'New value',
'#required' => TRUE,
);
// Verify setting the value of a nested element.
backdrop_array_set_nested_value($this->form, $this->parents, $new_value);
$this->assertEqual($this->form['fieldset']['element']['#value'], 'New value', 'Changed nested element value found.');
$this->assertIdentical($this->form['fieldset']['element']['#required'], TRUE, 'New nested element value found.');
}