function EntityStorageDeprecationTest::setUp

Overrides UnitTestCase::setUp

File

core/tests/Drupal/Tests/Core/Entity/EntityStorageDeprecationTest.php, line 111

Class

EntityStorageDeprecationTest
@coversDefaultClass \Drupal\Core\Entity\EntityStorageBase @group Entity @group legacy

Namespace

Drupal\Tests\Core\Entity

Code

protected function setUp() : void {
    $this->entityType = $this->createMock('Drupal\\Core\\Entity\\ContentEntityTypeInterface');
    $this->entityType
        ->expects($this->any())
        ->method('id')
        ->willReturn($this->entityTypeId);
    $this->entityType
        ->expects($this->any())
        ->method('getClass')
        ->willReturn('bogus_class');
    $this->container = new ContainerBuilder();
    \Drupal::setContainer($this->container);
    $this->entityTypeManager = $this->createMock(EntityTypeManager::class);
    $this->entityTypeBundleInfo = $this->createMock(EntityTypeBundleInfoInterface::class);
    $this->entityFieldManager = $this->createMock(EntityFieldManager::class);
    $this->moduleHandler = $this->createMock('Drupal\\Core\\Extension\\ModuleHandlerInterface');
    $this->cache = $this->createMock('Drupal\\Core\\Cache\\CacheBackendInterface');
    $this->languageManager = $this->createMock('Drupal\\Core\\Language\\LanguageManagerInterface');
    $this->languageManager
        ->expects($this->any())
        ->method('getDefaultLanguage')
        ->willReturn(new Language([
        'langcode' => 'en',
    ]));
    $this->connection = $this->getMockBuilder('Drupal\\Core\\Database\\Connection')
        ->disableOriginalConstructor()
        ->getMock();
    $this->container
        ->set('entity_type.manager', $this->entityTypeManager);
    $this->container
        ->set('entity_field.manager', $this->entityFieldManager);
}

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