function MenuStorageTest::testMaxIdLengthException
Same name in other branches
- 9 core/modules/system/tests/src/Kernel/Menu/MenuStorageTest.php \Drupal\Tests\system\Kernel\Menu\MenuStorageTest::testMaxIdLengthException()
- 8.9.x core/modules/system/tests/src/Kernel/Menu/MenuStorageTest.php \Drupal\Tests\system\Kernel\Menu\MenuStorageTest::testMaxIdLengthException()
- 11.x core/modules/system/tests/src/Kernel/Menu/MenuStorageTest.php \Drupal\Tests\system\Kernel\Menu\MenuStorageTest::testMaxIdLengthException()
Tests MenuStorage::MAX_ID_LENGTH is enforced.
File
-
core/
modules/ system/ tests/ src/ Kernel/ Menu/ MenuStorageTest.php, line 29
Class
- MenuStorageTest
- Tests MenuStorage.
Namespace
Drupal\Tests\system\Kernel\MenuCode
public function testMaxIdLengthException() : void {
$id = $this->randomMachineName(MenuStorage::MAX_ID_LENGTH + 1);
$this->expectException(ConfigEntityIdLengthException::class);
$this->expectExceptionMessage(sprintf('Configuration entity ID %s exceeds maximum allowed length of %s characters.', $id, MenuStorage::MAX_ID_LENGTH));
Menu::create([
'id' => $id,
])->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.