You are here

protected function ContentEntityNormalizerTest::createMockFieldListItem in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\ContentEntityNormalizerTest::createMockFieldListItem()

Creates a mock field list item.

Parameters

bool $access:

Return value

\Drupal\Core\Field\FieldItemListInterface|\PHPUnit_Framework_MockObject_MockObject

2 calls to ContentEntityNormalizerTest::createMockFieldListItem()
ContentEntityNormalizerTest::testNormalize in core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php
Tests the normalize() method.
ContentEntityNormalizerTest::testNormalizeWithAccountContext in core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php
Tests the normalize() method with account context passed.

File

core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php, line 145
Contains \Drupal\Tests\serialization\Unit\Normalizer\ContentEntityNormalizerTest.

Class

ContentEntityNormalizerTest
@coversDefaultClass \Drupal\serialization\Normalizer\ContentEntityNormalizer @group serialization

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

protected function createMockFieldListItem($access = TRUE, $user_context = NULL) {
  $mock = $this
    ->getMock('Drupal\\Core\\Field\\FieldItemListInterface');
  $mock
    ->expects($this
    ->once())
    ->method('access')
    ->with('view', $user_context)
    ->will($this
    ->returnValue($access));
  return $mock;
}