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


PHP AbstractModel::expects方法代码示例

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


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

示例1: testProcessRelations

 public function testProcessRelations()
 {
     $this->relationProcessorMock->expects($this->once())->method('processRelation')->with($this->salesModelMock);
     $this->salesModelMock->expects($this->once())->method('getEventPrefix')->willReturn('sales_event_prefix');
     $this->eventManagerMock->expects($this->once())->method('dispatch')->with('sales_event_prefix_process_relation', ['object' => $this->salesModelMock]);
     $this->entityRelationComposite->processRelations($this->salesModelMock);
 }
开发者ID:kid17,项目名称:magento2,代码行数:7,代码来源:EntityRelationCompositeTest.php

示例2: testSyncRemove

 public function testSyncRemove()
 {
     $this->eventObserverMock->expects($this->once())->method('getDataObject')->willReturn($this->salesModelMock);
     $this->salesModelMock->expects($this->once())->method('getId')->willReturn('sales-id-value');
     $this->gridAggregatorMock->expects($this->once())->method('purge')->with('sales-id-value');
     $this->unit->execute($this->eventObserverMock);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:7,代码来源:GridSyncRemoveObserverTest.php

示例3: testSyncInsert

 public function testSyncInsert()
 {
     $this->eventObserverMock->expects($this->once())->method('getObject')->willReturn($this->salesModelMock);
     $this->salesModelMock->expects($this->once())->method('getId')->willReturn('sales-id-value');
     $this->scopeConfigurationMock->expects($this->once())->method('getValue')->with('dev/grid/async_indexing', 'default', null)->willReturn(false);
     $this->gridAggregatorMock->expects($this->once())->method('refresh')->with('sales-id-value');
     $this->unit->execute($this->eventObserverMock);
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:8,代码来源:GridSyncInsertObserverTest.php

示例4: testSaveFailed

 /**
  * @expectedException \Exception
  * @expectedExceptionMessage Expected Exception
  * @throws \Exception
  */
 public function testSaveFailed()
 {
     $this->modelMock->expects($this->any())->method('getEventPrefix')->will($this->returnValue('event_prefix'));
     $this->modelMock->expects($this->any())->method('getEventObject')->will($this->returnValue('event_object'));
     $this->appResourceMock->expects($this->once())->method('getConnection')->will($this->returnValue($this->connectionMock));
     $exception = new \Exception('Expected Exception');
     $this->modelMock->expects($this->any())->method('getId')->will($this->throwException($exception));
     $this->connectionMock->expects($this->once())->method('beginTransaction');
     $this->connectionMock->expects($this->once())->method('rollback');
     $this->eventManagerMock->expects($this->once())->method('dispatch')->with('event_prefix_save_attribute_before', ['event_object' => $this->attribute, 'object' => $this->modelMock, 'attribute' => ['attribute']]);
     $this->attribute->saveAttribute($this->modelMock, 'attribute');
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:17,代码来源:AttributeTest.php


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