You are here

public function LinkCollectionNormalizerTest::linkAccessTestData in Drupal 9

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',
      ],
    ],
  ];
}