final class EntityMockFactory in Hook Event Dispatcher 3.x
Same name and namespace in other branches
- 8.2 modules/preprocess_event_dispatcher/tests/src/Unit/Helpers/EntityMockFactory.php \Drupal\Tests\preprocess_event_dispatcher\Unit\Helpers\EntityMockFactory
Class EntityMock.
Hierarchy
- class \Drupal\Tests\preprocess_event_dispatcher\Unit\Helpers\EntityMockFactory
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\HelpersView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityMockFactory:: |
public static | function | Get a full Entity mock. |