class RestPermissionsTest
Same name and namespace in other branches
- 11.x core/modules/rest/tests/src/Kernel/Entity/RestPermissionsTest.php \Drupal\Tests\rest\Kernel\Entity\RestPermissionsTest
- 10 core/modules/rest/tests/src/Kernel/Entity/RestPermissionsTest.php \Drupal\Tests\rest\Kernel\Entity\RestPermissionsTest
@coversDefaultClass \Drupal\rest\RestPermissions
@group rest
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \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 implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\rest\Kernel\Entity\RestPermissionsTest implements \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of RestPermissionsTest
File
-
core/
modules/ rest/ tests/ src/ Kernel/ Entity/ RestPermissionsTest.php, line 14
Namespace
Drupal\Tests\rest\Kernel\EntityView source
class RestPermissionsTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'rest',
'dblog',
'serialization',
'basic_auth',
'user',
];
/**
* @covers ::permissions
*/
public function testPermissions() {
RestResourceConfig::create([
'id' => 'dblog',
'plugin_id' => 'dblog',
'granularity' => RestResourceConfigInterface::METHOD_GRANULARITY,
'configuration' => [
'GET' => [
'supported_auth' => [
'cookie',
],
'supported_formats' => [
'json',
],
],
],
])->save();
$permissions = $this->container
->get('user.permissions')
->getPermissions();
$this->assertArrayHasKey('restful get dblog', $permissions);
$this->assertSame([
'config' => [
'rest.resource.dblog',
],
], $permissions['restful get dblog']['dependencies']);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.