MenuResourceTestBase.php in Drupal 10
File
core/modules/system/tests/src/Functional/Rest/MenuResourceTestBase.php
View source
<?php
namespace Drupal\Tests\system\Functional\Rest;
use Drupal\system\Entity\Menu;
use Drupal\Tests\rest\Functional\EntityResource\ConfigEntityResourceTestBase;
abstract class MenuResourceTestBase extends ConfigEntityResourceTestBase {
protected static $modules = [];
protected static $entityTypeId = 'menu';
protected $entity;
protected function setUpAuthorization($method) {
$this
->grantPermissionsToTestedRole([
'administer menu',
]);
}
protected function createEntity() {
$menu = Menu::create([
'id' => 'menu',
'label' => 'Menu',
'description' => 'Menu',
]);
$menu
->save();
return $menu;
}
protected function getExpectedNormalizedEntity() {
return [
'dependencies' => [],
'description' => 'Menu',
'id' => 'menu',
'label' => 'Menu',
'langcode' => 'en',
'locked' => FALSE,
'status' => TRUE,
'uuid' => $this->entity
->uuid(),
];
}
protected function getNormalizedPostEntity() {
return [];
}
protected function getExpectedCacheContexts() {
return [
'user.permissions',
];
}
}