You are here

protected function NodeOptionPremiumHelperTest::createPremiumNode in Node Option Premium 8

Creates a prophesized node.

Return value

\Prophecy\Prophecy\ProphecyInterface|\Drupal\node\NodeInterface The mocked node.

2 calls to NodeOptionPremiumHelperTest::createPremiumNode()
NodeOptionPremiumHelperTest::testHasFullAccessAsOwner in tests/src/Unit/NodeOptionPremiumHelperTest.php
Tests that the owner of an entity always has access.
NodeOptionPremiumHelperTest::testNoAccessAsNonOwner in tests/src/Unit/NodeOptionPremiumHelperTest.php
Tests that non-owners have no access.

File

tests/src/Unit/NodeOptionPremiumHelperTest.php, line 64

Class

NodeOptionPremiumHelperTest
@coversDefaultClass \Drupal\nopremium\NodeOptionPremiumHelper

Namespace

Drupal\Tests\nopremium\Unit

Code

protected function createPremiumNode() {

  // Pick an entity type that implements both ContentEntityInterface and
  // EntityOwnerInterface.
  $node = $this
    ->prophesize(NodeInterface::class);

  // Configure that the entity does have a premium field.
  $node
    ->hasField('premium')
    ->willReturn(TRUE);

  // The entity's bundle is 'foo'.
  $node
    ->bundle()
    ->willReturn('foo');
  return $node;
}