Tests getting nested array values.
function testGet() {
// Verify getting a value of a nested element.
$value = drupal_array_get_nested_value($this->form, $this->parents);
$this
->assertEqual($value['#value'], 'Nested element', 'Nested element value found.');
// Verify changing a value of a nested element by reference.
$value =& drupal_array_get_nested_value($this->form, $this->parents);
$value['#value'] = 'New value';
$value = drupal_array_get_nested_value($this->form, $this->parents);
$this
->assertEqual($value['#value'], 'New value', 'Nested element value was changed by reference.');
$this
->assertEqual($this->form['details']['element']['#value'], 'New value', 'Nested element value was changed by reference.');
// Verify that an existing key is reported back.
$key_exists = NULL;
drupal_array_get_nested_value($this->form, $this->parents, $key_exists);
$this
->assertIdentical($key_exists, TRUE, 'Existing key found.');
// Verify that a non-existing key is reported back and throws no errors.
$key_exists = NULL;
$parents = $this->parents;
$parents[] = 'foo';
drupal_array_get_nested_value($this->form, $parents, $key_exists);
$this
->assertIdentical($key_exists, FALSE, 'Non-existing key not found.');
}