You are here

protected function EntityTypeBundleInfoTest::createNewTestSubject in Entity Construction Kit (ECK) 8

Creates a new test subject.

Return value

\Drupal\eck\EckEntityTypeBundleInfo The newly created test subject.

6 calls to EntityTypeBundleInfoTest::createNewTestSubject()
EntityTypeBundleInfoTest::createNewTestSubjectWithEntityType in tests/src/Unit/EntityTypeBundleInfoTest.php
Creates a new test subject with an entity type.
EntityTypeBundleInfoTest::entityTypeHasBundlesMethodCachesData in tests/src/Unit/EntityTypeBundleInfoTest.php
Tests caching of data.
EntityTypeBundleInfoTest::returnsFalseWhenNonExistingEntityTypeIsPassed in tests/src/Unit/EntityTypeBundleInfoTest.php
Tests that entityTypeHasBundles returns false on non-existing entity type.
EntityTypeBundleInfoTest::returnsNoMachineNamesIfEntityTypeDoesNotExist in tests/src/Unit/EntityTypeBundleInfoTest.php
Tests that no machine names are returned if the entity type doesn't exist.
EntityTypeBundleInfoTest::returnsZeroIfEntityTypeDoesNotExist in tests/src/Unit/EntityTypeBundleInfoTest.php
Tests that zero is returned if the entity type doesn't exist.

... See full list

File

tests/src/Unit/EntityTypeBundleInfoTest.php, line 178

Class

EntityTypeBundleInfoTest
Tests the form element implementation.

Namespace

Drupal\Tests\eck\Unit

Code

protected function createNewTestSubject() {
  if (NULL === $this->entityTypeManagerMock) {
    $this->entityTypeManagerMock = $this
      ->getMockForAbstractClass(EntityTypeManagerInterface::class);
    $this->entityTypeManagerMock
      ->method('getDefinitions')
      ->willReturn([]);
  }
  if (NULL === $this->languageManagerMock) {
    $this->languageManagerMock = $this
      ->createLanguageManagerMock();
  }
  if (NULL === $this->moduleHandlerMock) {
    $this->moduleHandlerMock = $this
      ->getMockForAbstractClass(ModuleHandlerInterface::class);
  }
  if (NULL === $this->typedDataManagerMock) {
    $this->typedDataManagerMock = $this
      ->getMockForAbstractClass(TypedDataManagerInterface::class);
  }
  if (NULL === $this->cacheBackendMock) {
    $this->cacheBackendMock = $this
      ->getMockForAbstractClass(CacheBackendInterface::class);
  }
  return new EckEntityTypeBundleInfo($this->entityTypeManagerMock, $this->languageManagerMock, $this->moduleHandlerMock, $this->typedDataManagerMock, $this->cacheBackendMock);
}