public function NestedArrayTest::testSetValueForce 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::testSetValueForce()
Tests force-setting values.
@covers ::setValue
File
- core/
tests/ Drupal/ Tests/ Component/ Utility/ NestedArrayTest.php, line 100 - Contains \Drupal\Tests\Component\Utility\NestedArrayTest.
Class
- NestedArrayTest
- @coversDefaultClass \Drupal\Component\Utility\NestedArray @group Utility
Namespace
Drupal\Tests\Component\UtilityCode
public function testSetValueForce() {
$new_value = array(
'one',
);
$this->form['details']['non-array-parent'] = 'string';
$parents = array(
'details',
'non-array-parent',
'child',
);
NestedArray::setValue($this->form, $parents, $new_value, TRUE);
$this
->assertSame($new_value, $this->form['details']['non-array-parent']['child'], 'The nested element was not forced to the new value.');
}