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


PHP ObjectManager::expects方法代码示例

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


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

示例1: testCreate

 public function testCreate()
 {
     $type = '1';
     $data = ['data2', 'data3'];
     $this->objectManagerMock->expects($this->once())->method('create')->with($type, $data);
     $this->conditionFactory->create($type, $data);
 }
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:7,代码来源:ConditionFactoryTest.php

示例2: testCreate

 public function testCreate()
 {
     $rawResponse = ['documents' => [['title' => 'oneTitle', 'description' => 'oneDescription'], ['title' => 'twoTitle', 'description' => 'twoDescription']], 'aggregations' => []];
     $exceptedResponse = ['documents' => [[['name' => 'title', 'value' => 'oneTitle'], ['name' => 'description', 'value' => 'oneDescription']], [['name' => 'title', 'value' => 'twoTitle'], ['name' => 'description', 'value' => 'twoDescription']]], 'aggregations' => []];
     $this->documentFactory->expects($this->at(0))->method('create')->with($this->equalTo($exceptedResponse['documents'][0]))->will($this->returnValue('document1'));
     $this->documentFactory->expects($this->at(1))->method('create')->with($exceptedResponse['documents'][1])->will($this->returnValue('document2'));
     $this->objectManager->expects($this->once())->method('create')->with($this->equalTo('\\Magento\\Framework\\Search\\QueryResponse'), $this->equalTo(['documents' => ['document1', 'document2'], 'aggregations' => null]))->will($this->returnValue('QueryResponseObject'));
     $result = $this->factory->create($rawResponse);
     $this->assertEquals('QueryResponseObject', $result);
 }
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:10,代码来源:ResponseFactoryTest.php

示例3: exceptionResponse

 /**
  * Processing section runtime errors
  *
  * @return void
  */
 protected function exceptionResponse()
 {
     $dataMock = $this->getMock('Magento\\Core\\Helper\\Data', ['jsonEncode'], [], '', false);
     $this->objectManagerMock->expects($this->once())->method('get')->will($this->returnValue($dataMock));
     $dataMock->expects($this->once())->method('jsonEncode')->will($this->returnValue('{json-data}'));
     $this->responseMock->expects($this->once())->method('representJson')->with('{json-data}');
 }
开发者ID:zhangjiachao,项目名称:magento2,代码行数:12,代码来源:AddCommentTest.php


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