function ConfigDependenciesTest::providerOnDependencyRemovalForResourceGranularity

Same name and namespace in other branches
  1. 9 core/modules/rest/tests/src/Kernel/Entity/ConfigDependenciesTest.php \Drupal\Tests\rest\Kernel\Entity\ConfigDependenciesTest::providerOnDependencyRemovalForResourceGranularity()
  2. 9 core/modules/hal/tests/src/Kernel/rest/Entity/ConfigDependenciesTest.php \Drupal\Tests\hal\Kernel\rest\Entity\ConfigDependenciesTest::providerOnDependencyRemovalForResourceGranularity()
  3. 10 core/modules/rest/tests/src/Kernel/Entity/ConfigDependenciesTest.php \Drupal\Tests\rest\Kernel\Entity\ConfigDependenciesTest::providerOnDependencyRemovalForResourceGranularity()
  4. 11.x core/modules/rest/tests/src/Kernel/Entity/ConfigDependenciesTest.php \Drupal\Tests\rest\Kernel\Entity\ConfigDependenciesTest::providerOnDependencyRemovalForResourceGranularity()

Return value

array An array with numerical keys: 0. The original REST resource configuration. 1. The module to uninstall (the dependency that is about to be removed). 2. The expected configuration after uninstalling this module.

File

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

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 providerOnDependencyRemovalForResourceGranularity() {
    return [
        'resource with multiple formats' => [
            [
                'plugin_id' => 'entity:entity_test',
                'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY,
                'configuration' => [
                    'methods' => [
                        'GET',
                        'POST',
                    ],
                    'formats' => [
                        'json',
                        'hal_json',
                    ],
                    'authentication' => [
                        'cookie',
                        'basic_auth',
                    ],
                ],
            ],
            'hal',
            [
                'methods' => [
                    'GET',
                    'POST',
                ],
                'formats' => [
                    'json',
                ],
                'authentication' => [
                    'cookie',
                    'basic_auth',
                ],
            ],
        ],
        'resource with only HAL+JSON format' => [
            [
                'plugin_id' => 'entity:entity_test',
                'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY,
                'configuration' => [
                    'methods' => [
                        'GET',
                        'POST',
                    ],
                    'formats' => [
                        'hal_json',
                    ],
                    'authentication' => [
                        'cookie',
                        'basic_auth',
                    ],
                ],
            ],
            'hal',
            FALSE,
        ],
        'resource with multiple authentication providers' => [
            [
                'plugin_id' => 'entity:entity_test',
                'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY,
                'configuration' => [
                    'methods' => [
                        'GET',
                        'POST',
                    ],
                    'formats' => [
                        'json',
                        'hal_json',
                    ],
                    'authentication' => [
                        'cookie',
                        'basic_auth',
                    ],
                ],
            ],
            'basic_auth',
            [
                'methods' => [
                    'GET',
                    'POST',
                ],
                'formats' => [
                    'json',
                    'hal_json',
                ],
                'authentication' => [
                    'cookie',
                ],
            ],
        ],
        'resource with only basic_auth authentication' => [
            [
                'plugin_id' => 'entity:entity_test',
                'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY,
                'configuration' => [
                    'methods' => [
                        'GET',
                        'POST',
                    ],
                    'formats' => [
                        'json',
                        'hal_json',
                    ],
                    'authentication' => [
                        'basic_auth',
                    ],
                ],
            ],
            'basic_auth',
            FALSE,
        ],
    ];
}

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