You are here

protected function SqlContentEntityStorageTest::setUp in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php \Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest::setUp()
  2. 9 core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php \Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest::setUp()

File

core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php, line 117
Contains \Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest.

Class

SqlContentEntityStorageTest
@coversDefaultClass \Drupal\Core\Entity\Sql\SqlContentEntityStorage @group Entity

Namespace

Drupal\Tests\Core\Entity\Sql

Code

protected function setUp() : void {
  $this->entityType = $this
    ->createMock('Drupal\\Core\\Entity\\ContentEntityTypeInterface');
  $this->entityType
    ->expects($this
    ->any())
    ->method('id')
    ->will($this
    ->returnValue($this->entityTypeId));
  $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')
    ->will($this
    ->returnValue(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);
}