You are here

private function ApiTest::getCreator in Lightning API 8.4

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/ApiTest.php \Drupal\Tests\lightning_api\Functional\ApiTest::getCreator()

Creates an API user with all privileges for a single content type.

Parameters

string $node_type: The content type ID.

Return value

string The API access token.

2 calls to ApiTest::getCreator()
ApiTest::testAllowed in tests/src/Functional/ApiTest.php
Tests Getting data as anon and authenticated user.
ApiTest::testForbidden in tests/src/Functional/ApiTest.php
Tests access to unauthorized data is denied, regardless of authentication.

File

tests/src/Functional/ApiTest.php, line 81

Class

ApiTest
Tests that OAuth and JSON:API authenticate and authorize entity operations.

Namespace

Drupal\Tests\lightning_api\Functional

Code

private function getCreator($node_type) {
  return $this
    ->createApiUser([
    "access content",
    "bypass node access",
    "create {$node_type} content",
    "create url aliases",
    "delete {$node_type} revisions",
    "edit any {$node_type} content",
    "edit own {$node_type} content",
    "revert {$node_type} revisions",
    "view all revisions",
    "view own unpublished content",
    "view {$node_type} revisions",
  ]);
}