You are here

protected function RoleAccessTest::createTestNode in Search API 8

Creates a test node and return its key in the test nodes array.

Parameters

string $title: The title of the node.

Return value

int The position of the node in the test array.

5 calls to RoleAccessTest::createTestNode()
RoleAccessTest::testComputedFieldValues in tests/src/Kernel/Processor/RoleAccessTest.php
Tests whether the correct field values are created for nodes.
RoleAccessTest::testDefaultingToLoggedInUser in tests/src/Kernel/Processor/RoleAccessTest.php
Tests whether the access check correctly defaults to the logged-in user.
RoleAccessTest::testIdBasedCurrentUser in tests/src/Kernel/Processor/RoleAccessTest.php
Tests the account in the processor when it's based on an ID.
RoleAccessTest::testQueryAccessBypass in tests/src/Kernel/Processor/RoleAccessTest.php
Tests whether the "search_api_bypass_access" query option is respected.
RoleAccessTest::testRoleBasedAccess in tests/src/Kernel/Processor/RoleAccessTest.php
Tests the role based access filtering.

File

tests/src/Kernel/Processor/RoleAccessTest.php, line 250

Class

RoleAccessTest
Tests the "Role-based access" processor.

Namespace

Drupal\Tests\search_api\Kernel\Processor

Code

protected function createTestNode(string $title) : int {
  $node = Node::create([
    'status' => NodeInterface::PUBLISHED,
    'type' => 'page',
    'title' => $title,
  ]);
  $node
    ->save();
  $this->nodes[] = $node;
  end($this->nodes);
  return key($this->nodes);
}