You are here

public function ConfigUpdateUnitTestBase::mockGetStorage in Configuration Update Manager 8

Mocks the getStorage() method for the entity manager.

File

tests/src/Unit/ConfigUpdateUnitTestBase.php, line 90

Class

ConfigUpdateUnitTestBase
Base class for unit testing in Config Update Manager.

Namespace

Drupal\Tests\config_update\Unit

Code

public function mockGetStorage($entity_type) {

  // Figure out the config prefix for this entity type.
  $prefix = '';
  foreach ($this->entityDefinitionInformation as $info) {
    if ($info['type'] == $entity_type) {
      $prefix = $info['prefix'];
    }
  }

  // This is used in ConfigReverter::import(). Although it is supposed to
  // be entity storage, we'll use our mock config object instead.
  return new MockConfig('', $prefix, $this);
}