当前位置: 首页>>代码示例>>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;未经允许,请勿转载。