You are here

public static function EntityMockFactory::getMock in Hook Event Dispatcher 3.x

Same name and namespace in other branches
  1. 8.2 modules/preprocess_event_dispatcher/tests/src/Unit/Helpers/EntityMockFactory.php \Drupal\Tests\preprocess_event_dispatcher\Unit\Helpers\EntityMockFactory::getMock()

Get a full Entity mock.

Parameters

string $class: Class of mocked entity.

string $type: Entity type.

string $bundle: Entity bundle.

string $viewMode: View mode.

Return value

\Drupal\Core\Entity\EntityInterface EntityMock.

10 calls to EntityMockFactory::getMock()
EntityEventTest::testCommentEvent in modules/preprocess_event_dispatcher/tests/src/Unit/EntityEventTest.php
Test a BlockPreprocessEvent.
EntityEventTest::testEckEntityEvent in modules/preprocess_event_dispatcher/tests/src/Unit/EntityEventTest.php
Test a EckEntityPreprocessEvent.
EntityEventTest::testNodeEvent in modules/preprocess_event_dispatcher/tests/src/Unit/EntityEventTest.php
Test a NodePreprocessEvent.
EntityEventTest::testParagraphEvent in modules/preprocess_event_dispatcher/tests/src/Unit/EntityEventTest.php
Test a ParagraphPreprocessEvent.
EntityEventTest::testTaxonomyTermEvent in modules/preprocess_event_dispatcher/tests/src/Unit/EntityEventTest.php
Test a TaxonomyTermPreprocessEvent.

... See full list

File

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

Class

EntityMockFactory
Class EntityMock.

Namespace

Drupal\Tests\preprocess_event_dispatcher\Unit\Helpers

Code

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,
  ]);
}