MenuResourceTestBase.php
Same filename in other branches
- 9 core/modules/system/tests/src/Functional/Rest/MenuResourceTestBase.php
- 8.9.x core/modules/rest/tests/src/Functional/EntityResource/Menu/MenuResourceTestBase.php
- 8.9.x core/modules/system/tests/src/Functional/Rest/MenuResourceTestBase.php
- 10 core/modules/system/tests/src/Functional/Rest/MenuResourceTestBase.php
Namespace
Drupal\Tests\system\Functional\RestFile
-
core/
modules/ system/ tests/ src/ Functional/ Rest/ MenuResourceTestBase.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\system\Functional\Rest;
use Drupal\system\Entity\Menu;
use Drupal\Tests\rest\Functional\EntityResource\ConfigEntityResourceTestBase;
abstract class MenuResourceTestBase extends ConfigEntityResourceTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [];
/**
* {@inheritdoc}
*/
protected static $entityTypeId = 'menu';
/**
* @var \Drupal\system\MenuInterface
*/
protected $entity;
/**
* {@inheritdoc}
*/
protected function setUpAuthorization($method) {
$this->grantPermissionsToTestedRole([
'administer menu',
]);
}
/**
* {@inheritdoc}
*/
protected function createEntity() {
$menu = Menu::create([
'id' => 'menu',
'label' => 'Menu',
'description' => 'Menu',
]);
$menu->save();
return $menu;
}
/**
* {@inheritdoc}
*/
protected function getExpectedNormalizedEntity() {
return [
'dependencies' => [],
'description' => 'Menu',
'id' => 'menu',
'label' => 'Menu',
'langcode' => 'en',
'locked' => FALSE,
'status' => TRUE,
'uuid' => $this->entity
->uuid(),
];
}
/**
* {@inheritdoc}
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
return [];
}
/**
* {@inheritdoc}
*/
protected function getExpectedCacheContexts() {
return [
'user.permissions',
];
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
MenuResourceTestBase |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.