
| Current Path : /var/www/html/rocksensor1/web/core/modules/system/tests/src/Kernel/Menu/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor1/web/core/modules/system/tests/src/Kernel/Menu/MenuStorageTest.php |
<?php
declare(strict_types=1);
namespace Drupal\Tests\system\Kernel\Menu;
use Drupal\Core\Config\Entity\Exception\ConfigEntityIdLengthException;
use Drupal\KernelTests\KernelTestBase;
use Drupal\system\Entity\Menu;
use Drupal\system\MenuStorage;
/**
* Tests MenuStorage.
*
* @group Menu
*
* @see \Drupal\system\MenuStorage
*/
class MenuStorageTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = ['system'];
/**
* Tests MenuStorage::MAX_ID_LENGTH is enforced.
*/
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();
}
}