本文整理汇总了PHP中Magento\Customer\Api\GroupManagementInterface::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP GroupManagementInterface::expects方法的具体用法?PHP GroupManagementInterface::expects怎么用?PHP GroupManagementInterface::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Customer\Api\GroupManagementInterface
的用法示例。
在下文中一共展示了GroupManagementInterface::expects方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
parent::setUp();
$this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class)->getMockForAbstractClass();
$this->groupRepositoryMock = $this->getMockBuilder(GroupRepositoryInterface::class)->getMockForAbstractClass();
$this->groupManagementMock = $this->getMockBuilder(GroupManagementInterface::class)->getMockForAbstractClass();
$this->searchCriteriaBuilderMock = $this->getMockBuilder(SearchCriteriaBuilder::class)->disableOriginalConstructor()->getMock();
$this->moduleManagerMock = $this->getMockBuilder(ModuleManager::class)->disableOriginalConstructor()->getMock();
$this->directoryHelperMock = $this->getMockBuilder(DirectoryHelper::class)->disableOriginalConstructor()->getMock();
$this->productResourceMock = $this->getMockBuilder(ProductResource::class)->disableOriginalConstructor()->getMock();
$this->attributeMock = $this->getMockBuilder(Attribute::class)->disableOriginalConstructor()->getMock();
$this->customerGroupMock = $this->getMockBuilder(CustomerGroupInterface::class)->getMockForAbstractClass();
$this->groupManagementMock->expects($this->any())->method('getAllCustomersGroup')->willReturn($this->customerGroupMock);
}
示例2: setUp
protected function setUp()
{
$this->objectManagerHelper = new ObjectManagerHelper($this);
$this->product = $this->objectManagerHelper->getObject('Magento\\Catalog\\Model\\Product');
$this->tpFactory = $this->getMockForAbstractClass('Magento\\Catalog\\Api\\Data\\ProductTierPriceInterfaceFactory', [], '', false, true, true, ['create']);
$this->websiteMock = $this->getMock('Magento\\Store\\Model\\Website', ['getId'], [], '', false);
$storeMangerMock = $this->getMockForAbstractClass('Magento\\Store\\Model\\StoreManagerInterface', [], '', false, true, true, ['getWebsite']);
$storeMangerMock->expects($this->any())->method('getWebsite')->will($this->returnValue($this->websiteMock));
$this->scopeConfigMock = $this->getMockForAbstractClass('Magento\\Framework\\App\\Config\\ScopeConfigInterface', [], '', false, true, true, ['getValue']);
$group = $this->getMock('\\Magento\\Customer\\Model\\Data\\Group', [], [], '', false);
$group->expects($this->any())->method('getId')->willReturn(GroupManagement::CUST_GROUP_ALL);
$this->groupManagementMock = $this->getMock('Magento\\Customer\\Api\\GroupManagementInterface', [], [], '', false);
$this->groupManagementMock->expects($this->any())->method('getAllCustomersGroup')->will($this->returnValue($group));
$this->model = $this->objectManagerHelper->getObject('Magento\\Catalog\\Model\\Product\\Type\\Price', ['tierPriceFactory' => $this->tpFactory, 'config' => $this->scopeConfigMock, 'storeManager' => $storeMangerMock, 'groupManagement' => $this->groupManagementMock]);
}
示例3: testGetQuoteWithoutQuoteId
/**
* Run test getQuote method
*
* @return void
*/
public function testGetQuoteWithoutQuoteId()
{
$quoteId = 22;
$storeId = 10;
$customerId = 66;
$customerGroupId = 77;
$this->quote->expects($this->any())->method('getQuoteId')->will($this->returnValue(null));
$this->quote->expects($this->any())->method('setQuoteId')->with($quoteId);
$cartInterfaceMock = $this->getMock('\\Magento\\Quote\\Api\\Data\\CartInterface', ['getId', 'setId', 'getCreatedAt', 'setCreatedAt', 'getUpdatedAt', 'setUpdatedAt', 'getConvertedAt', 'setConvertedAt', 'getIsActive', 'setIsActive', 'getIsVirtual', 'getItems', 'setItems', 'getItemsCount', 'setItemsCount', 'getItemsQty', 'setItemsQty', 'getCustomer', 'setCustomer', 'getBillingAddress', 'setBillingAddress', 'getReservedOrderId', 'setReservedOrderId', 'getOrigOrderId', 'setOrigOrderId', 'getCurrency', 'setCurrency', 'getCustomerIsGuest', 'setCustomerIsGuest', 'getCustomerNote', 'setCustomerNote', 'getCustomerNoteNotify', 'setCustomerNoteNotify', 'getCustomerTaxClassId', 'setCustomerTaxClassId', 'getStoreId', 'setStoreId', 'getExtensionAttributes', 'setExtensionAttributes', 'setIgnoreOldQty', 'setIsSuperMode', 'setCustomerGroupId']);
$this->quoteFactoryMock->expects($this->once())->method('create')->willReturn($cartInterfaceMock);
$this->quote->expects($this->any())->method('getStoreId')->will($this->returnValue($storeId));
$this->quote->expects($this->any())->method('getCustomerId')->will($this->returnValue($customerId));
$cartInterfaceMock->expects($this->atLeastOnce())->method('getId')->willReturn($quoteId);
$defaultGroup = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\GroupInterface')->getMock();
$defaultGroup->expects($this->any())->method('getId')->will($this->returnValue($customerGroupId));
$this->groupManagementMock->expects($this->any())->method('getDefaultGroup')->will($this->returnValue($defaultGroup));
$dataCustomerMock = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\CustomerInterface')->disableOriginalConstructor()->getMock();
$this->customerRepositoryMock->expects($this->once())->method('getById')->with($customerId)->willReturn($dataCustomerMock);
$quoteMock = $this->getMock('Magento\\Quote\\Model\\Quote', ['setStoreId', 'setCustomerGroupId', 'setIsActive', 'assignCustomer', 'setIgnoreOldQty', 'setIsSuperMode', '__wakeup'], [], '', false);
$this->quoteRepositoryMock->expects($this->once())->method('get')->willReturn($quoteMock);
$cartInterfaceMock->expects($this->once())->method('setCustomerGroupId')->with($customerGroupId)->will($this->returnSelf());
$quoteMock->expects($this->once())->method('assignCustomer')->with($dataCustomerMock);
$quoteMock->expects($this->once())->method('setIgnoreOldQty')->with(true);
$quoteMock->expects($this->once())->method('setIsSuperMode')->with(true);
$this->assertEquals($quoteMock, $this->quote->getQuote());
}
示例4: testExtract
public function testExtract()
{
$customerData = ['firstname' => 'firstname', 'lastname' => 'firstname', 'email' => 'email.example.com'];
$this->formFactory->expects($this->once())->method('create')->with('customer', 'form-code')->willReturn($this->customerForm);
$this->customerForm->expects($this->once())->method('extractData')->with($this->request)->willReturn($customerData);
$this->customerForm->expects($this->once())->method('getAllowedAttributes')->willReturn(['group_id' => 'attribute object']);
$this->customerFactory->expects($this->once())->method('create')->willReturn($this->customerData);
$this->dataObjectHelper->expects($this->once())->method('populateWithArray')->with($this->customerData, $customerData, '\\Magento\\Customer\\Api\\Data\\CustomerInterface')->willReturn($this->customerData);
$this->storeManager->expects($this->once())->method('getStore')->willReturn($this->store);
$this->store->expects($this->exactly(2))->method('getId')->willReturn(1);
$this->customerGroupManagement->expects($this->once())->method('getDefaultGroup')->with(1)->willReturn($this->customerGroup);
$this->customerGroup->expects($this->once())->method('getId')->willReturn(1);
$this->customerData->expects($this->once())->method('setGroupId')->with(1);
$this->store->expects($this->once())->method('getWebsiteId')->willReturn(1);
$this->customerData->expects($this->once())->method('setWebsiteId')->with(1);
$this->customerData->expects($this->once())->method('setStoreId')->with(1);
$this->assertSame($this->customerData, $this->customerExtractor->extract('form-code', $this->request));
}