本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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');
}