function ConfigTest::testSetInvalidOffsetValue
Tests set invalid offset value.
File
-
core/
tests/ Drupal/ Tests/ Core/ Config/ ConfigTest.php, line 277
Class
- ConfigTest
- Tests the Config.
Namespace
Drupal\Tests\Core\ConfigCode
public function testSetInvalidOffsetValue() : 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 "invalidOffset" on non-array value.');
$this->config
->set('testData.invalidOffset', 1);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.