You are here

final class EntityMockFactory in Hook Event Dispatcher 8.2

Same name and namespace in other branches
  1. 3.x modules/preprocess_event_dispatcher/tests/src/Unit/Helpers/EntityMockFactory.php \Drupal\Tests\preprocess_event_dispatcher\Unit\Helpers\EntityMockFactory

Class EntityMock.

Hierarchy

Expanded class hierarchy of EntityMockFactory

2 files declare their use of EntityMockFactory
EntityEventTest.php in modules/preprocess_event_dispatcher/tests/src/Unit/EntityEventTest.php
EntityEventVariablesTest.php in modules/preprocess_event_dispatcher/tests/src/Unit/EntityEventVariablesTest.php

File

modules/preprocess_event_dispatcher/tests/src/Unit/Helpers/EntityMockFactory.php, line 11

Namespace

Drupal\Tests\preprocess_event_dispatcher\Unit\Helpers
View source
final class EntityMockFactory {

  /**
   * Get a full Entity mock.
   *
   * @param string $class
   *   Class of mocked entity.
   * @param string $type
   *   Entity type.
   * @param string $bundle
   *   Entity bundle.
   * @param string $viewMode
   *   View mode.
   *
   * @return \Drupal\Core\Entity\EntityInterface
   *   EntityMock.
   */
  public static function getMock(string $class, string $type, string $bundle, string $viewMode) : EntityInterface {
    return Mockery::mock($class, EntityInterface::class, [
      'getEntityType' => $type,
      'bundle' => $bundle,
      'getViewMode' => $viewMode,
    ]);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityMockFactory::getMock public static function Get a full Entity mock.