function LinkCollectionNormalizerTest::linkAccessTestData

Same name in other branches
  1. 9 core/modules/jsonapi/tests/src/Kernel/Normalizer/LinkCollectionNormalizerTest.php \Drupal\Tests\jsonapi\Kernel\Normalizer\LinkCollectionNormalizerTest::linkAccessTestData()
  2. 10 core/modules/jsonapi/tests/src/Kernel/Normalizer/LinkCollectionNormalizerTest.php \Drupal\Tests\jsonapi\Kernel\Normalizer\LinkCollectionNormalizerTest::linkAccessTestData()

Provides test cases for testing link access checking.

Return value

array[]

File

core/modules/jsonapi/tests/src/Kernel/Normalizer/LinkCollectionNormalizerTest.php, line 173

Class

LinkCollectionNormalizerTest
@coversDefaultClass \Drupal\jsonapi\Normalizer\LinkCollectionNormalizer @group jsonapi

Namespace

Drupal\Tests\jsonapi\Kernel\Normalizer

Code

public static function linkAccessTestData() {
    return [
        'the edit-form link is present because uid 2 has access to the targeted resource (its own edit form)' => [
            'current_user_id' => 2,
            'edit_form_uid' => 2,
            'expected_link_keys' => [
                'edit-form',
            ],
            'expected_cache_contexts' => [
                'url.site',
                'user',
            ],
        ],
        "the edit-form link is omitted because uid 3 doesn't have access to the targeted resource (another account's edit form)" => [
            'current_user_id' => 3,
            'edit_form_uid' => 2,
            'expected_link_keys' => [],
            'expected_cache_contexts' => [
                'url.site',
                'user',
            ],
        ],
    ];
}

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