class MenuStorageTest
Same name and namespace in other branches
- 11.x core/modules/system/tests/src/Kernel/Menu/MenuStorageTest.php \Drupal\Tests\system\Kernel\Menu\MenuStorageTest
- 10 core/modules/system/tests/src/Kernel/Menu/MenuStorageTest.php \Drupal\Tests\system\Kernel\Menu\MenuStorageTest
- 8.9.x core/modules/system/tests/src/Kernel/Menu/MenuStorageTest.php \Drupal\Tests\system\Kernel\Menu\MenuStorageTest
Tests MenuStorage.
@group Menu
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\system\Kernel\Menu\MenuStorageTest extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of MenuStorageTest
See also
File
-
core/
modules/ system/ tests/ src/ Kernel/ Menu/ MenuStorageTest.php, line 17
Namespace
Drupal\Tests\system\Kernel\MenuView source
class MenuStorageTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'system',
];
/**
* Tests MenuStorage::MAX_ID_LENGTH is enforced.
*/
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();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.