本文整理汇总了PHP中Drupal\Core\Entity\EntityTypeInterface::setClass方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityTypeInterface::setClass方法的具体用法?PHP EntityTypeInterface::setClass怎么用?PHP EntityTypeInterface::setClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Entity\EntityTypeInterface
的用法示例。
在下文中一共展示了EntityTypeInterface::setClass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupTestLoad
/**
* Setup for the tests of the ::load() method.
*/
function setupTestLoad()
{
// Use an entity type object which has the methods enabled which are being
// called by the protected method Entity::getEntityTypeFromStaticClass().
$methods = get_class_methods('Drupal\\Core\\Entity\\EntityType');
unset($methods[array_search('getClass', $methods)]);
unset($methods[array_search('setClass', $methods)]);
$this->entityType = $this->getMockBuilder('\\Drupal\\Core\\Entity\\EntityType')->disableOriginalConstructor()->setMethods($methods)->getMock();
// Base our mocked entity on a real entity class so we can test if calling
// Entity::load() on the base class will bubble up to an actual entity.
$this->entityTypeId = 'entity_test_mul';
$methods = get_class_methods('Drupal\\entity_test\\Entity\\EntityTestMul');
unset($methods[array_search('load', $methods)]);
unset($methods[array_search('loadMultiple', $methods)]);
unset($methods[array_search('create', $methods)]);
$this->entity = $this->getMockBuilder('Drupal\\entity_test\\Entity\\EntityTestMul')->disableOriginalConstructor()->setMethods($methods)->getMock();
$this->entityType->setClass(get_class($this->entity));
$this->entityManager->expects($this->once())->method('getDefinitions')->will($this->returnValue(array($this->entityTypeId => $this->entityType)));
$this->entityType->expects($this->any())->method('id')->will($this->returnValue($this->entityTypeId));
}