protected function EntityPrintTest::getMockEntity in Entity Print 8
Get a mock entity for testing.
Parameters
string $entity_label: (optional) The label title for the entity.
Return value
\PHPUnit_Framework_MockObject_MockObject The content entity mock.
2 calls to EntityPrintTest::getMockEntity()
- EntityPrintTest::testGenerateFilename in tests/
src/ Unit/ EntityPrintTest.php - Test safe file generation.
- EntityPrintTest::testGenerateMultipleFilename in tests/
src/ Unit/ EntityPrintTest.php - Test multiple file generation.
File
- tests/
src/ Unit/ EntityPrintTest.php, line 104
Class
- EntityPrintTest
- @coversDefaultClass \Drupal\entity_print\EntityPrintPdfBuilder @group entity_print
Namespace
Drupal\Tests\entity_print\UnitCode
protected function getMockEntity($entity_label = '') {
$entity = $this
->getMock('Drupal\\Core\\Entity\\EntityInterface');
if ($entity_label) {
$entity
->expects($this
->any())
->method('label')
->willReturn($entity_label);
}
return $entity;
}