function JsonApiTopLevelResourceNormalizerTest::getTestConfigEntityResource

Get a test resource type, resource object and includes for config entity.

Return value

array Indexed array with values:

  • Resource type.
  • Resource object.
  • Includes.
1 call to JsonApiTopLevelResourceNormalizerTest::getTestConfigEntityResource()
JsonApiTopLevelResourceNormalizerTest::testConfigEntityResourceObjectSchema in core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiTopLevelResourceNormalizerTest.php
Test the generated config resource object normalization against the schema.

File

core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiTopLevelResourceNormalizerTest.php, line 292

Class

JsonApiTopLevelResourceNormalizerTest
@coversDefaultClass \Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer @group jsonapi

Namespace

Drupal\Tests\jsonapi\Kernel\Normalizer

Code

protected function getTestConfigEntityResource() : array {
    $resource_type = $this->container
        ->get('jsonapi.resource_type.repository')
        ->get('action', 'action');
    $resource_object = ResourceObject::createFromEntity($resource_type, Action::create([
        'id' => 'user_add_role_action.' . RoleInterface::ANONYMOUS_ID,
        'type' => 'user',
        'label' => 'Add the anonymous role to the selected users',
        'configuration' => [
            'rid' => RoleInterface::ANONYMOUS_ID,
        ],
        'plugin' => 'user_add_role_action',
    ]));
    return [
        $resource_type,
        $resource_object,
        new NullIncludedData(),
    ];
}

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