You are here

public function RestJsonApiUnsupported::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php \Drupal\Tests\jsonapi\Functional\RestJsonApiUnsupported::setUp()

Overrides ResourceTestBase::setUp

File

core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php, line 64

Class

RestJsonApiUnsupported
Ensures that the 'api_json' format is not supported by the REST module.

Namespace

Drupal\Tests\jsonapi\Functional

Code

public function setUp() : void {
  parent::setUp();

  // Set up a HTTP client that accepts relative URLs.
  $this->httpClient = $this->container
    ->get('http_client_factory')
    ->fromOptions([
    'base_uri' => $this->baseUrl,
  ]);

  // Create a "Camelids" node type.
  NodeType::create([
    'name' => 'Camelids',
    'type' => 'camelids',
  ])
    ->save();

  // Create a "Llama" node.
  $node = Node::create([
    'type' => 'camelids',
  ]);
  $node
    ->setTitle('Llama')
    ->setOwnerId(0)
    ->setPublished()
    ->save();
}