function ContentEntityNormalizerTest::setUp

Same name and namespace in other branches
  1. 9 core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\ContentEntityNormalizerTest::setUp()
  2. 10 core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\ContentEntityNormalizerTest::setUp()
  3. 11.x core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php \Drupal\Tests\serialization\Unit\Normalizer\ContentEntityNormalizerTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/serialization/tests/src/Unit/Normalizer/ContentEntityNormalizerTest.php, line 37

Class

ContentEntityNormalizerTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21serialization%21src%21Normalizer%21ContentEntityNormalizer.php/class/ContentEntityNormalizer/8.9.x" title="Normalizes/denormalizes Drupal content entities into an array structure." class="local">\Drupal\serialization\Normalizer\ContentEntityNormalizer</a> @group serialization

Namespace

Drupal\Tests\serialization\Unit\Normalizer

Code

protected function setUp() {
    $entity_field_manager = $this->createMock(EntityFieldManagerInterface::class);
    $entity_type_manager = $this->createMock(EntityTypeManagerInterface::class);
    $entity_type_repository = $this->createMock(EntityTypeRepositoryInterface::class);
    $this->contentEntityNormalizer = new ContentEntityNormalizer($entity_type_manager, $entity_type_repository, $entity_field_manager);
    $this->serializer = $this->getMockBuilder('Symfony\\Component\\Serializer\\Serializer')
        ->disableOriginalConstructor()
        ->setMethods([
        'normalize',
    ])
        ->getMock();
    $this->contentEntityNormalizer
        ->setSerializer($this->serializer);
}

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