function EntityStorageBaseTest::generateEntityInterface
Same name in other branches
- 10 core/tests/Drupal/Tests/Core/Entity/EntityStorageBaseTest.php \Drupal\Tests\Core\Entity\EntityStorageBaseTest::generateEntityInterface()
- 11.x core/tests/Drupal/Tests/Core/Entity/EntityStorageBaseTest.php \Drupal\Tests\Core\Entity\EntityStorageBaseTest::generateEntityInterface()
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.