public function EntityStorageBaseTest::generateEntityInterface in Drupal 10
Generate a mocked entity object.
Parameters
string $id: ID value for this entity.
Return value
\Drupal\Core\Entity\EntityInterface|\PHPUnit\Framework\MockObject\MockObject The mocked entity.
2 calls to EntityStorageBaseTest::generateEntityInterface()
- EntityStorageBaseTest::providerLoad in core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityStorageBaseTest.php - Data provider for testLoad().
- EntityStorageBaseTest::providerLoadMultiple in core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityStorageBaseTest.php - Data provider for testLoadMultiple.
File
- core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityStorageBaseTest.php, line 22
Class
- EntityStorageBaseTest
- @coversDefaultClass \Drupal\Core\Entity\EntityStorageBase @group Entity
Namespace
Drupal\Tests\Core\EntityCode
public function generateEntityInterface($id) {
$mock_entity = $this
->getMockBuilder('\\Drupal\\Core\\Entity\\EntityInterface')
->onlyMethods([
'id',
])
->getMockForAbstractClass();
$mock_entity
->expects($this
->any())
->method('id')
->willReturn((string) $id);
return $mock_entity;
}