function ConfigDependenciesTest::testOnDependencyRemovalRemoveAuthAndFormats
Same name in other branches
- 8.9.x core/modules/rest/tests/src/Kernel/Entity/ConfigDependenciesTest.php \Drupal\Tests\rest\Kernel\Entity\ConfigDependenciesTest::testOnDependencyRemovalRemoveAuthAndFormats()
@covers ::onDependencyRemoval @covers ::onDependencyRemovalForMethodGranularity
File
-
core/
modules/ hal/ tests/ src/ Kernel/ rest/ Entity/ ConfigDependenciesTest.php, line 168
Class
- ConfigDependenciesTest
- @coversDefaultClass \Drupal\rest\Entity\ConfigDependencies
Namespace
Drupal\Tests\hal\Kernel\rest\EntityCode
public function testOnDependencyRemovalRemoveAuthAndFormats() {
$config_dependencies = new ConfigDependencies([
'hal_json' => 'hal',
'json' => 'serialization',
], [
'basic_auth' => 'basic_auth',
]);
$rest_config = RestResourceConfig::create([
'plugin_id' => 'entity:entity_test',
'granularity' => RestResourceConfigInterface::METHOD_GRANULARITY,
'configuration' => [
'GET' => [
'supported_auth' => [
'cookie',
],
'supported_formats' => [
'json',
],
],
'POST' => [
'supported_auth' => [
'basic_auth',
],
'supported_formats' => [
'hal_json',
],
],
],
]);
$this->assertTrue($config_dependencies->onDependencyRemoval($rest_config, [
'module' => [
'basic_auth',
'hal',
],
]));
$this->assertEquals([
'json',
], $rest_config->getFormats('GET'));
$this->assertEquals([
'cookie',
], $rest_config->getAuthenticationProviders('GET'));
$this->assertEquals([], $rest_config->getFormats('POST'));
$this->assertEquals([], $rest_config->getAuthenticationProviders('POST'));
$this->assertEquals([
'GET' => [
'supported_auth' => [
'cookie',
],
'supported_formats' => [
'json',
],
],
], $rest_config->get('configuration'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.