You are here

public function ConfigDependenciesTest::testOnDependencyRemovalForResourceGranularity in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/rest/tests/src/Kernel/Entity/ConfigDependenciesTest.php \Drupal\Tests\rest\Kernel\Entity\ConfigDependenciesTest::testOnDependencyRemovalForResourceGranularity()
  2. 9 core/modules/rest/tests/src/Kernel/Entity/ConfigDependenciesTest.php \Drupal\Tests\rest\Kernel\Entity\ConfigDependenciesTest::testOnDependencyRemovalForResourceGranularity()

@covers ::onDependencyRemoval @covers ::onDependencyRemovalForResourceGranularity

@dataProvider providerOnDependencyRemovalForResourceGranularity

File

core/modules/rest/tests/src/Kernel/Entity/ConfigDependenciesTest.php, line 133

Class

ConfigDependenciesTest
@coversDefaultClass \Drupal\rest\Entity\ConfigDependencies

Namespace

Drupal\Tests\rest\Kernel\Entity

Code

public function testOnDependencyRemovalForResourceGranularity(array $configuration, $module, $expected_configuration) {
  assert(is_string($module));
  assert($expected_configuration === FALSE || is_array($expected_configuration));
  $config_dependencies = new ConfigDependencies([
    'json' => 'serialization',
  ], [
    'basic_auth' => 'basic_auth',
  ]);
  $rest_config = RestResourceConfig::create($configuration);
  $this
    ->assertSame(!empty($expected_configuration), $config_dependencies
    ->onDependencyRemoval($rest_config, [
    'module' => [
      $module,
    ],
  ]));
  if (!empty($expected_configuration)) {
    $this
      ->assertEquals($expected_configuration, $rest_config
      ->get('configuration'));
  }
}