当前位置: 首页>>代码示例>>PHP>>正文


PHP SelectInterface::expects方法代码示例

本文整理汇总了PHP中Drupal\Core\Database\Query\SelectInterface::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP SelectInterface::expects方法的具体用法?PHP SelectInterface::expects怎么用?PHP SelectInterface::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\Core\Database\Query\SelectInterface的用法示例。


在下文中一共展示了SelectInterface::expects方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 /**
  * Sets up required mocks and the CommentStatistics service under test.
  */
 protected function setUp()
 {
     $this->statement = $this->getMockBuilder('Drupal\\Core\\Database\\Driver\\sqlite\\Statement')->disableOriginalConstructor()->getMock();
     $this->statement->expects($this->any())->method('fetchObject')->will($this->returnCallback(array($this, 'fetchObjectCallback')));
     $this->select = $this->getMockBuilder('Drupal\\Core\\Database\\Query\\Select')->disableOriginalConstructor()->getMock();
     $this->select->expects($this->any())->method('fields')->will($this->returnSelf());
     $this->select->expects($this->any())->method('condition')->will($this->returnSelf());
     $this->select->expects($this->any())->method('execute')->will($this->returnValue($this->statement));
     $this->database = $this->getMockBuilder('Drupal\\Core\\Database\\Connection')->disableOriginalConstructor()->getMock();
     $this->database->expects($this->once())->method('select')->will($this->returnValue($this->select));
     $this->commentStatistics = new CommentStatistics($this->database, $this->getMock('Drupal\\Core\\Session\\AccountInterface'), $this->getMock('Drupal\\Core\\Entity\\EntityManagerInterface'), $this->getMock('Drupal\\Core\\State\\StateInterface'));
 }
开发者ID:sarahwillem,项目名称:OD8,代码行数:15,代码来源:CommentStatisticsUnitTest.php

示例2: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Create a Mock database connection object.
     $this->connection = $this->getMockBuilder('Drupal\\Core\\Database\\Connection')->disableOriginalConstructor()->getMock();
     // Create a Mock Statement object
     $this->statement = $this->getMockBuilder('Drupal\\Core\\Database\\Driver\\sqlite\\Statement')->disableOriginalConstructor()->getMock();
     // Create a Mock Select object and set expectations.
     $this->select = $this->getMockBuilder('Drupal\\Core\\Database\\Query\\Select')->disableOriginalConstructor()->getMock();
     $this->select->expects($this->any())->method('fields')->will($this->returnSelf());
     $this->select->expects($this->any())->method('condition')->will($this->returnSelf());
     $this->select->expects($this->any())->method('range')->will($this->returnSelf());
     $this->select->expects($this->any())->method('orderBy')->will($this->returnSelf());
     $this->select->expects($this->any())->method('execute')->will($this->returnValue($this->statement));
     $this->connection->expects($this->any())->method('select')->will($this->returnValue($this->select));
     // Create a Mock Delete object and set expectations.
     $this->delete = $this->getMockBuilder('Drupal\\Core\\Database\\Query\\Delete')->disableOriginalConstructor()->getMock();
     $this->delete->expects($this->any())->method('condition')->will($this->returnSelf());
     $this->delete->expects($this->any())->method('execute')->will($this->returnValue($this->statement));
 }
开发者ID:C4AProjects,项目名称:c4apage,代码行数:23,代码来源:AuthmapTest.php


注:本文中的Drupal\Core\Database\Query\SelectInterface::expects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。