public function NestedArrayTest::testSetValue in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Component/Utility/NestedArrayTest.php \Drupal\Tests\Component\Utility\NestedArrayTest::testSetValue()
Tests setting nested array values.
@covers ::setValue
File
- core/
tests/ Drupal/ Tests/ Component/ Utility/ NestedArrayTest.php, line 83 - Contains \Drupal\Tests\Component\Utility\NestedArrayTest.
Class
- NestedArrayTest
- @coversDefaultClass \Drupal\Component\Utility\NestedArray @group Utility
Namespace
Drupal\Tests\Component\UtilityCode
public function testSetValue() {
$new_value = array(
'#value' => 'New value',
'#required' => TRUE,
);
// Verify setting the value of a nested element.
NestedArray::setValue($this->form, $this->parents, $new_value);
$this
->assertSame('New value', $this->form['details']['element']['#value'], 'Changed nested element value found.');
$this
->assertTrue($this->form['details']['element']['#required'], 'New nested element value found.');
}