function EntityAdapterUnitTest::setUpMockFieldItemList

Reinitializes the field item list as a mock object.

2 calls to EntityAdapterUnitTest::setUpMockFieldItemList()
EntityAdapterUnitTest::testApplyDefaultValue in core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php
Tests apply default value.
EntityAdapterUnitTest::testSet in core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php
Tests set.

File

core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php, line 223

Class

EntityAdapterUnitTest
Tests Drupal\Core\Entity\Plugin\DataType\EntityAdapter.

Namespace

Drupal\Tests\Core\Entity\TypedData

Code

protected function setUpMockFieldItemList() : void {
  $this->fieldTypePluginManager = $this->createStub(FieldTypePluginManager::class);
  $this->fieldItemList = $this->createMock(FieldItemListInterface::class);
  $this->fieldTypePluginManager
    ->method('createFieldItemList')
    ->willReturn($this->fieldItemList);
  \Drupal::getContainer()->set('plugin.manager.field.field_type', $this->fieldTypePluginManager);
}

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