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


PHP DisplayPluginBase::expects方法代碼示例

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


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

示例1: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->entityManager = $this->getMock('Drupal\\Core\\Entity\\EntityManagerInterface');
     $this->entityStorage = $this->getMock('Drupal\\Core\\Entity\\EntityStorageInterface');
     $this->entityViewBuilder = $this->getMock('Drupal\\Core\\Entity\\EntityViewBuilderInterface');
     $this->executable = $this->getMockBuilder('Drupal\\views\\ViewExecutable')->disableOriginalConstructor()->getMock();
     $this->display = $this->getMockBuilder('Drupal\\views\\Plugin\\views\\display\\DisplayPluginBase')->disableOriginalConstructor()->getMock();
     $this->stylePlugin = $this->getMockBuilder('Drupal\\views\\Plugin\\views\\style\\StylePluginBase')->disableOriginalConstructor()->getMock();
     $this->executable->style_plugin = $this->stylePlugin;
     $this->entityHandler = new Entity(array(), 'entity', array('entity_type' => 'entity_test'), $this->entityManager);
     $this->display->expects($this->any())->method('getPlugin')->with('style')->willReturn($this->stylePlugin);
     $this->executable->expects($this->any())->method('getStyle')->willReturn($this->stylePlugin);
     $token = $this->getMockBuilder('Drupal\\Core\\Utility\\Token')->disableOriginalConstructor()->getMock();
     $token->expects($this->any())->method('replace')->willReturnArgument(0);
     $container = new ContainerBuilder();
     $container->set('token', $token);
     \Drupal::setContainer($container);
 }
開發者ID:nstielau,項目名稱:drops-8,代碼行數:22,代碼來源:EntityTest.php

示例2: testGetRenderTokensWithArguments

 /**
  * @covers ::getRenderTokens
  */
 public function testGetRenderTokensWithArguments()
 {
     $field = $this->setupTestField(['id' => 'id']);
     $field->view->args = ['argument value'];
     $field->view->build_info['substitutions']['{{ arguments.name }}'] = 'argument value';
     $argument = $this->getMockBuilder('\\Drupal\\views\\Plugin\\views\\argument\\ArgumentPluginBase')->disableOriginalConstructor()->getMock();
     $field->last_render = 'last rendered output';
     $this->display->expects($this->any())->method('getHandlers')->willReturnMap([['argument', ['name' => $argument]], ['field', ['id' => $field]]]);
     $expected = ['{{ id }}' => 'last rendered output', '{{ arguments.name }}' => 'argument value', '{{ raw_arguments.name }}' => 'argument value'];
     $this->assertEquals($expected, $field->getRenderTokens([]));
 }
開發者ID:dmyerson,項目名稱:d8ecs,代碼行數:14,代碼來源:FieldPluginBaseTest.php

示例3: setupDisplayWithEmptyArgumentsAndFields

 /**
  * Sets up a display with empty arguments and fields.
  */
 protected function setupDisplayWithEmptyArgumentsAndFields()
 {
     $this->display->expects($this->any())->method('getHandlers')->willReturnMap([['argument', []], ['field', []]]);
 }
開發者ID:nstielau,項目名稱:drops-8,代碼行數:7,代碼來源:FieldPluginBaseTest.php


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