You are here

public function ContentEntityNormalizerTest::createMockForContentEntity 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::createMockForContentEntity()

Creates a mock content entity.

Parameters

$definitions:

Return value

\PHPUnit_Framework_MockObject_MockObject

2 calls to ContentEntityNormalizerTest::createMockForContentEntity()
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 126
Contains \Drupal\Tests\serialization\Unit\Normalizer\ContentEntityNormalizerTest.

Class

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

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

public function createMockForContentEntity($definitions) {
  $content_entity_mock = $this
    ->getMockBuilder('Drupal\\Core\\Entity\\ContentEntityBase')
    ->disableOriginalConstructor()
    ->setMethods(array(
    'getFields',
  ))
    ->getMockForAbstractClass();
  $content_entity_mock
    ->expects($this
    ->once())
    ->method('getFields')
    ->will($this
    ->returnValue($definitions));
  return $content_entity_mock;
}