RoleResourceTestBase.php in Drupal 10
File
core/modules/user/tests/src/Functional/Rest/RoleResourceTestBase.php
View source
<?php
namespace Drupal\Tests\user\Functional\Rest;
use Drupal\Tests\rest\Functional\EntityResource\ConfigEntityResourceTestBase;
use Drupal\user\Entity\Role;
abstract class RoleResourceTestBase extends ConfigEntityResourceTestBase {
protected static $modules = [
'user',
];
protected static $entityTypeId = 'user_role';
protected $entity;
protected function setUpAuthorization($method) {
$this
->grantPermissionsToTestedRole([
'administer permissions',
]);
}
protected function createEntity() {
$role = Role::create([
'id' => 'llama',
'label' => 'Llama',
]);
$role
->save();
return $role;
}
protected function getExpectedNormalizedEntity() {
return [
'uuid' => $this->entity
->uuid(),
'weight' => 2,
'langcode' => 'en',
'status' => TRUE,
'dependencies' => [],
'id' => 'llama',
'label' => 'Llama',
'is_admin' => NULL,
'permissions' => [],
];
}
protected function getNormalizedPostEntity() {
return [];
}
}