RestResourceConfigTest.php
Same filename in this branch
Same filename in other branches
- 8.9.x core/modules/jsonapi/tests/src/Functional/RestResourceConfigTest.php
- 8.9.x core/modules/rest/tests/src/Unit/Entity/RestResourceConfigTest.php
- 8.9.x core/modules/rest/tests/src/Kernel/Entity/RestResourceConfigTest.php
- 10 core/modules/jsonapi/tests/src/Functional/RestResourceConfigTest.php
- 10 core/modules/rest/tests/src/Unit/Entity/RestResourceConfigTest.php
- 10 core/modules/rest/tests/src/Kernel/Entity/RestResourceConfigTest.php
- 11.x core/modules/jsonapi/tests/src/Functional/RestResourceConfigTest.php
- 11.x core/modules/rest/tests/src/Unit/Entity/RestResourceConfigTest.php
- 11.x core/modules/rest/tests/src/Kernel/Entity/RestResourceConfigTest.php
Namespace
Drupal\Tests\rest\Unit\EntityFile
-
core/
modules/ rest/ tests/ src/ Unit/ Entity/ RestResourceConfigTest.php
View source
<?php
namespace Drupal\Tests\rest\Unit\Entity;
use Drupal\rest\Entity\RestResourceConfig;
use Drupal\rest\RestResourceConfigInterface;
use Drupal\Tests\UnitTestCase;
/**
* @coversDefaultClass \Drupal\rest\Entity\RestResourceConfig
*
* @group rest
*/
class RestResourceConfigTest extends UnitTestCase {
/**
* Asserts that rest methods are normalized to upper case.
*
* This also tests that no exceptions are thrown during that method so that
* alternate methods such as OPTIONS and PUT are supported.
*/
public function testNormalizeRestMethod() {
$expected = [
'GET',
'PUT',
'POST',
'PATCH',
'DELETE',
'OPTIONS',
'FOO',
];
$methods = [
'get',
'put',
'post',
'patch',
'delete',
'options',
'foo',
];
$configuration = [];
foreach ($methods as $method) {
$configuration[$method] = [
'supported_auth' => [
'cookie',
],
'supported_formats' => [
'json',
],
];
}
$entity = new RestResourceConfig([
'plugin_id' => 'entity:entity_test',
'granularity' => RestResourceConfigInterface::METHOD_GRANULARITY,
'configuration' => $configuration,
], 'rest_resource_config');
$this->assertEquals($expected, $entity->getMethods());
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
RestResourceConfigTest | @coversDefaultClass \Drupal\rest\Entity\RestResourceConfig |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.