本文整理匯總了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));
}