function LinkCollectionNormalizerTest::linkAccessTestData

Same name in other branches
  1. 10 core/modules/jsonapi/tests/src/Kernel/Normalizer/LinkCollectionNormalizerTest.php \Drupal\Tests\jsonapi\Kernel\Normalizer\LinkCollectionNormalizerTest::linkAccessTestData()
  2. 11.x 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 171

Class

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

Namespace

Drupal\Tests\jsonapi\Kernel\Normalizer

Code

public function linkAccessTestData() {
    return [
        'the edit-form link is present because uid 2 has access to the targeted resource (its own edit form)' => [
            'uid' => 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)" => [
            'uid' => 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.