function ContentPreprocessTest::setupNode

Same name in other branches
  1. 9 core/modules/content_moderation/tests/src/Unit/ContentPreprocessTest.php \Drupal\Tests\content_moderation\Unit\ContentPreprocessTest::setupNode()
  2. 8.9.x core/modules/content_moderation/tests/src/Unit/ContentPreprocessTest.php \Drupal\Tests\content_moderation\Unit\ContentPreprocessTest::setupNode()
  3. 10 core/modules/content_moderation/tests/src/Unit/ContentPreprocessTest.php \Drupal\Tests\content_moderation\Unit\ContentPreprocessTest::setupNode()

Mock a node object.

Parameters

int $nid: The node ID to mock.

Return value

\Drupal\node\Entity\Node The mocked node.

2 calls to ContentPreprocessTest::setupNode()
ContentPreprocessTest::setupCurrentRouteMatch in core/modules/content_moderation/tests/src/Unit/ContentPreprocessTest.php
Mock the current route matching object.
ContentPreprocessTest::testIsLatestVersionPage in core/modules/content_moderation/tests/src/Unit/ContentPreprocessTest.php
@covers ::isLatestVersionPage @dataProvider routeNodeProvider

File

core/modules/content_moderation/tests/src/Unit/ContentPreprocessTest.php, line 68

Class

ContentPreprocessTest
@coversDefaultClass \Drupal\content_moderation\ContentPreprocess

Namespace

Drupal\Tests\content_moderation\Unit

Code

protected function setupNode($nid) {
    $node = $this->prophesize(Node::class);
    $node->id()
        ->willReturn($nid);
    return $node->reveal();
}

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