public function ConfigDependenciesTest::testOnDependencyRemovalRemoveAuth in Drupal 10
Same name and namespace in other branches
- 8 core/modules/rest/tests/src/Kernel/Entity/ConfigDependenciesTest.php \Drupal\Tests\rest\Kernel\Entity\ConfigDependenciesTest::testOnDependencyRemovalRemoveAuth()
- 9 core/modules/rest/tests/src/Kernel/Entity/ConfigDependenciesTest.php \Drupal\Tests\rest\Kernel\Entity\ConfigDependenciesTest::testOnDependencyRemovalRemoveAuth()
@covers ::onDependencyRemoval @covers ::onDependencyRemovalForMethodGranularity
File
- core/
modules/ rest/ tests/ src/ Kernel/ Entity/ ConfigDependenciesTest.php, line 95
Class
- ConfigDependenciesTest
- @coversDefaultClass \Drupal\rest\Entity\ConfigDependencies
Namespace
Drupal\Tests\rest\Kernel\EntityCode
public function testOnDependencyRemovalRemoveAuth() {
$config_dependencies = new ConfigDependencies([
'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' => [
'json',
],
],
],
]);
$this
->assertTrue($config_dependencies
->onDependencyRemoval($rest_config, [
'module' => [
'basic_auth',
],
]));
$this
->assertEquals([
'cookie',
], $rest_config
->getAuthenticationProviders('GET'));
$this
->assertEquals([], $rest_config
->getAuthenticationProviders('POST'));
$this
->assertEquals([
'GET' => [
'supported_auth' => [
'cookie',
],
'supported_formats' => [
'json',
],
],
'POST' => [
'supported_formats' => [
'json',
],
],
], $rest_config
->get('configuration'));
}