public function MenuStorageTest::testMaxIdLengthException in Drupal 8
Same name and namespace in other branches
- 9 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 27
Class
- MenuStorageTest
- Tests MenuStorage.
Namespace
Drupal\Tests\system\Kernel\MenuCode
public function testMaxIdLengthException() {
$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();
}