You are here

protected function NodeTest::enableNodeConfiguration in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/rest/src/Tests/NodeTest.php \Drupal\rest\Tests\NodeTest::enableNodeConfiguration()

Enables node specific REST API configuration and authentication.

Parameters

string $method: The HTTP method to be tested.

string $operation: The operation, one of 'view', 'create', 'update' or 'delete'.

2 calls to NodeTest::enableNodeConfiguration()
NodeTest::postNode in core/modules/rest/src/Tests/NodeTest.php
Serializes and attempts to create a node via a REST "post" http request.
NodeTest::testNodes in core/modules/rest/src/Tests/NodeTest.php
Performs various tests on nodes and their REST API.

File

core/modules/rest/src/Tests/NodeTest.php, line 37
Contains \Drupal\rest\Tests\NodeTest.

Class

NodeTest
Tests special cases for node entities.

Namespace

Drupal\rest\Tests

Code

protected function enableNodeConfiguration($method, $operation) {
  $this
    ->enableService('entity:node', $method);
  $permissions = $this
    ->entityPermissions('node', $operation);
  $permissions[] = 'restful ' . strtolower($method) . ' entity:node';
  $account = $this
    ->drupalCreateUser($permissions);
  $this
    ->drupalLogin($account);
}