You are here

protected function ViewsCacheInvalidationTest::createNode in Search API 8

Creates a node with the given title and publication status.

Parameters

string $title: The title for the node.

bool $status: The publication status to set.

Throws

\Drupal\Core\Entity\EntityStorageException Thrown if an error occurred during the saving of the node.

2 calls to ViewsCacheInvalidationTest::createNode()
ViewsCacheInvalidationTest::setUp in tests/src/Kernel/Views/ViewsCacheInvalidationTest.php
ViewsCacheInvalidationTest::testQueryCacheInvalidation in tests/src/Kernel/Views/ViewsCacheInvalidationTest.php
Tests that a cached views query result is invalidated at the right moments.

File

tests/src/Kernel/Views/ViewsCacheInvalidationTest.php, line 466

Class

ViewsCacheInvalidationTest
Tests that cached Search API views get invalidated at the right occasions.

Namespace

Drupal\Tests\search_api\Kernel\Views

Code

protected function createNode($title, $status) {
  $values = [
    'title' => $title,
    'status' => $status,
    'type' => $this->contentType
      ->id(),
  ];
  $this->nodes[$title] = Node::create($values);
  $this->nodes[$title]
    ->save();
}