RestResourceConfigTest.php

Same filename in this branch
  1. 9 core/modules/jsonapi/tests/src/Functional/RestResourceConfigTest.php
  2. 9 core/modules/rest/tests/src/Unit/Entity/RestResourceConfigTest.php
  3. 9 core/modules/rest/tests/src/Kernel/Entity/RestResourceConfigTest.php
Same filename and directory in other branches
  1. 8.9.x core/modules/jsonapi/tests/src/Functional/RestResourceConfigTest.php
  2. 8.9.x core/modules/rest/tests/src/Unit/Entity/RestResourceConfigTest.php
  3. 8.9.x core/modules/rest/tests/src/Kernel/Entity/RestResourceConfigTest.php
  4. 10 core/modules/jsonapi/tests/src/Functional/RestResourceConfigTest.php
  5. 10 core/modules/rest/tests/src/Unit/Entity/RestResourceConfigTest.php
  6. 10 core/modules/rest/tests/src/Kernel/Entity/RestResourceConfigTest.php
  7. 11.x core/modules/jsonapi/tests/src/Functional/RestResourceConfigTest.php
  8. 11.x core/modules/rest/tests/src/Unit/Entity/RestResourceConfigTest.php
  9. 11.x core/modules/rest/tests/src/Kernel/Entity/RestResourceConfigTest.php

Namespace

Drupal\Tests\hal\Kernel\rest\Entity

File

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

View source
<?php

namespace Drupal\Tests\hal\Kernel\rest\Entity;

use Drupal\KernelTests\KernelTestBase;
use Drupal\rest\Entity\RestResourceConfig;
use Drupal\rest\RestResourceConfigInterface;

/**
 * @coversDefaultClass \Drupal\rest\Entity\RestResourceConfig
 *
 * @group hal
 * @group legacy
 */
class RestResourceConfigTest extends KernelTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'rest',
        'entity_test',
        'serialization',
        'basic_auth',
        'user',
        'hal',
    ];
    
    /**
     * @covers ::calculateDependencies
     */
    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());
    }

}

Classes

Title Deprecated Summary
RestResourceConfigTest @coversDefaultClass \Drupal\rest\Entity\RestResourceConfig

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