本文整理汇总了PHP中Magento\Customer\Helper\Session\CurrentCustomer::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP CurrentCustomer::expects方法的具体用法?PHP CurrentCustomer::expects怎么用?PHP CurrentCustomer::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Customer\Helper\Session\CurrentCustomer
的用法示例。
在下文中一共展示了CurrentCustomer::expects方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetConfigWithEmptyCustomer
public function testGetConfigWithEmptyCustomer()
{
$customerId = 0;
$expected = ['payment' => ['paypalBillingAgreement' => ['agreements' => [], 'transportName' => AbstractAgreement::TRANSPORT_BILLING_AGREEMENT_ID]]];
$this->currentCustomerMock->expects($this->once())->method('getCustomerId')->willReturn($customerId);
$this->agreementFactoryMock->expects($this->never())->method('create');
$this->assertEquals($expected, $this->configProvider->getConfig());
}
示例2: testGetCollection
public function testGetCollection()
{
$this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue(new \Magento\Framework\Object(array('id' => 42))));
$this->currentCustomer->expects($this->any())->method('getCustomerId')->will($this->returnValue(4242));
$this->collection->expects($this->any())->method('addStoreFilter')->with(42)->will($this->returnValue($this->collection));
$this->collection->expects($this->any())->method('addCustomerFilter')->with(4242)->will($this->returnValue($this->collection));
$this->collection->expects($this->any())->method('setDateOrder')->with()->will($this->returnValue($this->collection));
$this->collection->expects($this->any())->method('setPageSize')->with(5)->will($this->returnValue($this->collection));
$this->collection->expects($this->any())->method('load')->with()->will($this->returnValue($this->collection));
$this->collection->expects($this->any())->method('addReviewSummary')->with()->will($this->returnValue($this->collection));
$this->assertSame($this->collection, $this->object->getCollection());
}
示例3: testSetLayoutWithoutAddress
public function testSetLayoutWithoutAddress()
{
$addressId = 1;
$customerPrefix = 'prefix';
$customerFirstName = 'firstname';
$customerMiddlename = 'middlename';
$customerLastname = 'lastname';
$customerSuffix = 'suffix';
$title = 'title';
$layoutMock = $this->getMockBuilder('Magento\\Framework\\View\\LayoutInterface')->getMock();
$this->requestMock->expects($this->once())->method('getParam')->with('id', null)->willReturn($addressId);
$this->addressRepositoryMock->expects($this->once())->method('getById')->with($addressId)->willThrowException(\Magento\Framework\Exception\NoSuchEntityException::singleField('addressId', $addressId));
$newAddressMock = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\AddressInterface')->getMock();
$this->addressDataFactoryMock->expects($this->once())->method('create')->willReturn($newAddressMock);
$customerMock = $this->getMockBuilder('Magento\\Customer\\Api\\Data\\CustomerInterface')->getMock();
$this->currentCustomerMock->expects($this->once())->method('getCustomer')->willReturn($customerMock);
$customerMock->expects($this->once())->method('getPrefix')->willReturn($customerPrefix);
$customerMock->expects($this->once())->method('getFirstname')->willReturn($customerFirstName);
$customerMock->expects($this->once())->method('getMiddlename')->willReturn($customerMiddlename);
$customerMock->expects($this->once())->method('getLastname')->willReturn($customerLastname);
$customerMock->expects($this->once())->method('getSuffix')->willReturn($customerSuffix);
$newAddressMock->expects($this->once())->method('setPrefix')->with($customerPrefix)->willReturnSelf();
$newAddressMock->expects($this->once())->method('setFirstname')->with($customerFirstName)->willReturnSelf();
$newAddressMock->expects($this->once())->method('setMiddlename')->with($customerMiddlename)->willReturnSelf();
$newAddressMock->expects($this->once())->method('setLastname')->with($customerLastname)->willReturnSelf();
$newAddressMock->expects($this->once())->method('setSuffix')->with($customerSuffix)->willReturnSelf();
$pageTitleMock = $this->getMockBuilder('Magento\\Framework\\View\\Page\\Title')->disableOriginalConstructor()->getMock();
$this->pageConfigMock->expects($this->once())->method('getTitle')->willReturn($pageTitleMock);
$this->model->setData('title', $title);
$pageTitleMock->expects($this->once())->method('set')->with($title)->willReturnSelf();
$this->assertEquals($this->model, $this->model->setLayout($layoutMock));
$this->assertEquals($layoutMock, $this->model->getLayout());
}