function HighWaterTest::nodeExists

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Kernel/HighWaterTest.php \Drupal\Tests\migrate\Kernel\HighWaterTest::nodeExists()
  2. 8.9.x core/modules/migrate/tests/src/Kernel/HighWaterTest.php \Drupal\Tests\migrate\Kernel\HighWaterTest::nodeExists()
  3. 11.x core/modules/migrate/tests/src/Kernel/HighWaterTest.php \Drupal\Tests\migrate\Kernel\HighWaterTest::nodeExists()

Checks if node with given title exists.

Parameters

string $title: Title of the node.

Return value

bool

2 calls to HighWaterTest::nodeExists()
HighWaterTest::assertNodeDoesNotExist in core/modules/migrate/tests/src/Kernel/HighWaterTest.php
Assert that node with given title does not exist.
HighWaterTest::assertNodeExists in core/modules/migrate/tests/src/Kernel/HighWaterTest.php
Assert that node with given title exists.

File

core/modules/migrate/tests/src/Kernel/HighWaterTest.php, line 299

Class

HighWaterTest
Tests migration high water property.

Namespace

Drupal\Tests\migrate\Kernel

Code

protected function nodeExists($title) {
    $query = \Drupal::entityQuery('node')->accessCheck(FALSE);
    $result = $query->condition('title', $title)
        ->range(0, 1)
        ->execute();
    return !empty($result);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.