You are here

protected function ApiTest::createContentType in Lightning API 8.3

Same name and namespace in other branches
  1. 8.4 tests/src/Functional/ApiTest.php \Drupal\Tests\lightning_api\Functional\ApiTest::createContentType()
2 calls to ApiTest::createContentType()
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 that authenticated and anonymous users cannot get unauthorized data.

File

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

Class

ApiTest
Tests OAuth and JSON:API authentication and interactions with entities.

Namespace

Drupal\Tests\lightning_api\Functional

Code

protected function createContentType(array $values = []) {
  $node_type = $this
    ->drupalCreateContentType($values);

  // The router needs to be rebuilt in order for the new content type to be
  // available to JSON:API.
  $this->container
    ->get('router.builder')
    ->rebuild();
  return $node_type;
}