當前位置: 首頁>>代碼示例>>PHP>>正文


PHP EntityTypeInterface::reveal方法代碼示例

本文整理匯總了PHP中Drupal\Core\Entity\EntityTypeInterface::reveal方法的典型用法代碼示例。如果您正苦於以下問題:PHP EntityTypeInterface::reveal方法的具體用法?PHP EntityTypeInterface::reveal怎麽用?PHP EntityTypeInterface::reveal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Drupal\Core\Entity\EntityTypeInterface的用法示例。


在下文中一共展示了EntityTypeInterface::reveal方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setUp

 /**
  * @covers ::__construct
  */
 public function setUp()
 {
     parent::setUp();
     $this->contextHandler = $this->prophesize(ContextHandlerInterface::class);
     $this->entityType = $this->prophesize(EntityTypeInterface::class);
     $module_handler = $this->prophesize(ModuleHandlerInterface::class);
     $module_handler->invokeAll(Argument::cetera())->willReturn([]);
     $this->pageAccess = new PageAccess($this->entityType->reveal(), $this->contextHandler->reveal());
     $this->pageAccess->setModuleHandler($module_handler->reveal());
 }
開發者ID:pulibrary,項目名稱:recap,代碼行數:13,代碼來源:PageAccessTest.php

示例2: setUp

 /**
  * @covers ::__construct
  */
 public function setUp()
 {
     parent::setUp();
     $this->contextHandler = $this->prophesize(ContextHandlerInterface::class);
     $this->entityType = $this->prophesize(EntityTypeInterface::class);
     $module_handler = $this->prophesize(ModuleHandlerInterface::class);
     $module_handler->invokeAll(Argument::cetera())->willReturn([]);
     $this->pageAccess = new PageAccess($this->entityType->reveal(), $this->contextHandler->reveal());
     $this->pageAccess->setModuleHandler($module_handler->reveal());
     $this->cacheContextsManager = $this->prophesize(CacheContextsManager::class);
     $container = new ContainerBuilder();
     $container->set('cache_contexts_manager', $this->cacheContextsManager->reveal());
     \Drupal::setContainer($container);
 }
開發者ID:ns-oxit-study,項目名稱:drupal-8-training,代碼行數:17,代碼來源:PageAccessTest.php

示例3: getEntity

 /**
  * Returns a mock entity for testing.
  *
  * @param string $class
  *   The class name to mock. Should be \Drupal\Core\Entity\Entity or a
  *   subclass.
  * @param array $values
  *   An array of entity values to construct the mock entity with.
  * @param array $methods
  *   (optional) An array of additional methods to mock on the entity object.
  *   The getEntityType() and entityManager() methods are always mocked.
  *
  * @return \Drupal\Core\Entity\Entity|\PHPUnit_Framework_MockObject_MockObject
  */
 protected function getEntity($class, array $values, array $methods = [])
 {
     $methods = array_merge($methods, ['getEntityType', 'entityManager']);
     // Prophecy does not allow prophesizing abstract classes while actually
     // calling their code. We use Prophecy below because that allows us to
     // add method prophecies later while still revealing the prophecy now.
     $entity = $this->getMockBuilder($class)->setConstructorArgs([$values, $this->entityTypeId])->setMethods($methods)->getMockForAbstractClass();
     $this->entityType = $this->prophesize(EntityTypeInterface::class);
     $this->entityType->getLinkTemplates()->willReturn([]);
     $this->entityType->getKey('langcode')->willReturn(FALSE);
     $entity->method('getEntityType')->willReturn($this->entityType->reveal());
     $this->entityManager = $this->prophesize(EntityManagerInterface::class);
     $entity->method('entityManager')->willReturn($this->entityManager->reveal());
     return $entity;
 }
開發者ID:DrupalCamp-NYC,項目名稱:dcnyc16,代碼行數:29,代碼來源:EntityUrlTest.php


注:本文中的Drupal\Core\Entity\EntityTypeInterface::reveal方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。