function RestResourceConfigTest::testCalculateDependencies

Same name in this branch
  1. 9 core/modules/rest/tests/src/Kernel/Entity/RestResourceConfigTest.php \Drupal\Tests\rest\Kernel\Entity\RestResourceConfigTest::testCalculateDependencies()
Same name in other branches
  1. 8.9.x core/modules/rest/tests/src/Kernel/Entity/RestResourceConfigTest.php \Drupal\Tests\rest\Kernel\Entity\RestResourceConfigTest::testCalculateDependencies()
  2. 10 core/modules/rest/tests/src/Kernel/Entity/RestResourceConfigTest.php \Drupal\Tests\rest\Kernel\Entity\RestResourceConfigTest::testCalculateDependencies()
  3. 11.x core/modules/rest/tests/src/Kernel/Entity/RestResourceConfigTest.php \Drupal\Tests\rest\Kernel\Entity\RestResourceConfigTest::testCalculateDependencies()

@covers ::calculateDependencies

File

core/modules/hal/tests/src/Kernel/rest/Entity/RestResourceConfigTest.php, line 32

Class

RestResourceConfigTest
@coversDefaultClass \Drupal\rest\Entity\RestResourceConfig

Namespace

Drupal\Tests\hal\Kernel\rest\Entity

Code

public function testCalculateDependencies() {
    $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',
                ],
            ],
        ],
    ]);
    $rest_config->calculateDependencies();
    $this->assertEquals([
        'module' => [
            'basic_auth',
            'entity_test',
            'hal',
            'serialization',
            'user',
        ],
    ], $rest_config->getDependencies());
}

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