本文整理匯總了PHP中Magento\TestFramework\Helper\ObjectManager::getCollectionMock方法的典型用法代碼示例。如果您正苦於以下問題:PHP ObjectManager::getCollectionMock方法的具體用法?PHP ObjectManager::getCollectionMock怎麽用?PHP ObjectManager::getCollectionMock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\TestFramework\Helper\ObjectManager
的用法示例。
在下文中一共展示了ObjectManager::getCollectionMock方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testGetListReturnsTheListOfActiveCheckoutAgreements
public function testGetListReturnsTheListOfActiveCheckoutAgreements()
{
$this->scopeConfigMock->expects($this->once())->method('isSetFlag')->with('checkout/options/enable_agreements', ScopeInterface::SCOPE_STORE, null)->will($this->returnValue(true));
$agreementData = array('id' => 1, 'name' => 'Checkout Agreement', 'content' => 'Agreement content: <b>HTML</b>', 'content_height' => '100px', 'checkbox_text' => 'Checkout Agreement Checkbox Text', 'active' => true, 'html' => true);
$storeId = 1;
$storeMock = $this->getMock('Magento\\Store\\Model\\Store', array(), array(), '', false);
$storeMock->expects($this->any())->method('getId')->will($this->returnValue($storeId));
$this->storeManagerMock->expects($this->any())->method('getStore')->will($this->returnValue($storeMock));
$collectionMock = $this->objectManager->getCollectionMock('Magento\\CheckoutAgreements\\Model\\Resource\\Agreement\\Collection', array($this->getAgreementMock($agreementData)));
$this->factoryMock->expects($this->once())->method('create')->will($this->returnValue($collectionMock));
$collectionMock->expects($this->once())->method('addStoreFilter')->with($storeId);
$collectionMock->expects($this->once())->method('addFieldToFilter')->with('is_active', 1);
$agreementDataObject = $this->getMock('Magento\\CheckoutAgreements\\Service\\V1\\Data\\Agreement', array(), array(), '', false);
$this->agreementBuilderMock->expects($this->once())->method('populateWithArray')->with($agreementData);
$this->agreementBuilderMock->expects($this->once())->method('create')->will($this->returnValue($agreementDataObject));
$this->assertEquals(array($agreementDataObject), $this->service->getList());
}