You are here

public function SchedulerSetupTrait::entityStorageObject in Scheduler 2.x

Returns the storage object of the entity type passed by string.

This allows previous usage of the hard-coded $this->nodeStorage to be replaced with $this->entityStorageObject($entityTypeId) when expanding the tests to cover media and product entity types.

Parameters

string $entityTypeId: The machine id of the entity type.

Return value

\Drupal\Core\Entity\ContentEntityStorageInterface The entity storage object.

17 calls to SchedulerSetupTrait::entityStorageObject()
SchedulerDevelGenerateTest::countScheduledEntities in tests/src/Functional/SchedulerDevelGenerateTest.php
Helper function to count scheduled entities and assert the expected number.
SchedulerEntityAccessTest::testEntityAccess in tests/src/Functional/SchedulerEntityAccessTest.php
Tests Scheduler cron functionality when access to the entity is denied.
SchedulerEventsTest::testSchedulerEvents in tests/src/Functional/SchedulerEventsTest.php
Tests six scheduler events for entity types other than node.
SchedulerHooksTest::approveEntity in tests/src/Functional/SchedulerHooksTest.php
Approves an entity for publication or unpublication.
SchedulerHooksTest::testList in tests/src/Functional/SchedulerHooksTest.php
Covers hook_scheduler_list() and hook_scheduler_{type}_list()

... See full list

File

tests/src/Traits/SchedulerSetupTrait.php, line 400

Class

SchedulerSetupTrait
Generic setup for all Scheduler tests.

Namespace

Drupal\Tests\scheduler\Traits

Code

public function entityStorageObject(string $entityTypeId) {
  return $this->container
    ->get('entity_type.manager')
    ->getStorage($entityTypeId);
}