當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。