function ConfigDependenciesTest::testOnDependencyRemovalForResourceGranularity

Same name and namespace in other branches
  1. 9 core/modules/rest/tests/src/Kernel/Entity/ConfigDependenciesTest.php \Drupal\Tests\rest\Kernel\Entity\ConfigDependenciesTest::testOnDependencyRemovalForResourceGranularity()
  2. 9 core/modules/hal/tests/src/Kernel/rest/Entity/ConfigDependenciesTest.php \Drupal\Tests\hal\Kernel\rest\Entity\ConfigDependenciesTest::testOnDependencyRemovalForResourceGranularity()
  3. 10 core/modules/rest/tests/src/Kernel/Entity/ConfigDependenciesTest.php \Drupal\Tests\rest\Kernel\Entity\ConfigDependenciesTest::testOnDependencyRemovalForResourceGranularity()
  4. 11.x 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 204

Class

ConfigDependenciesTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21rest%21src%21Entity%21ConfigDependencies.php/class/ConfigDependencies/8.9.x" title="Calculates rest resource config dependencies." class="local">\Drupal\rest\Entity\ConfigDependencies</a>

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([
        'hal_json' => 'hal',
        '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'));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.