protected function ContentHubExportQueueControllerTest::createMockForContentEntity in Acquia Content Hub 8
Creates a mock content entity.
Parameters
string $entity_type_id: The Entity type ID.
string $id: The Entity ID.
string $uuid: The Entity UUID.
Return value
\PHPUnit_Framework_MockObject_MockObject The fake ContentEntity.
1 call to ContentHubExportQueueControllerTest::createMockForContentEntity()
- ContentHubExportQueueControllerTest::testEnqueueExportEntities in tests/
src/ Unit/ Controller/ ContentHubExportQueueControllerTest.php - Test the enqueueExportEntities method.
File
- tests/
src/ Unit/ Controller/ ContentHubExportQueueControllerTest.php, line 230
Class
- ContentHubExportQueueControllerTest
- PHPUnit test for the ContentHubExportQueueController class.
Namespace
Drupal\Tests\acquia_contenthub\Unit\ControllerCode
protected function createMockForContentEntity($entity_type_id, $id, $uuid) {
$enabled_methods = [
'getEntityTypeId',
'id',
'uuid',
'getFields',
];
$content_entity_mock = $this
->getMockBuilder('Drupal\\Core\\Entity\\ContentEntityBase')
->disableOriginalConstructor()
->setMethods($enabled_methods)
->getMockForAbstractClass();
$content_entity_mock
->method('getEntityTypeId')
->willReturn($entity_type_id);
$content_entity_mock
->method('id')
->willReturn($id);
$content_entity_mock
->method('uuid')
->willReturn($uuid);
// No fields. We are just testing we can add item to the queue.
$content_entity_mock
->method('getFields')
->willReturn([]);
return $content_entity_mock;
}