function ConfigTest::testSetIllegalOffsetValue
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest::testSetIllegalOffsetValue()
- 8.9.x core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest::testSetIllegalOffsetValue()
- 11.x core/tests/Drupal/Tests/Core/Config/ConfigTest.php \Drupal\Tests\Core\Config\ConfigTest::testSetIllegalOffsetValue()
@covers ::set
File
-
core/
tests/ Drupal/ Tests/ Core/ Config/ ConfigTest.php, line 274
Class
- ConfigTest
- Tests the Config.
Namespace
Drupal\Tests\Core\ConfigCode
public function testSetIllegalOffsetValue() : void {
// Set a single value.
$this->config
->set('testData', 1);
// Attempt to treat the single value as a nested item.
$this->expectException(\LogicException::class);
$this->expectExceptionMessage('Cannot create key "illegalOffset" on non-array value.');
$this->config
->set('testData.illegalOffset', 1);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.