本文整理汇总了PHP中Magento\Catalog\Model\CategoryFactory::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP CategoryFactory::expects方法的具体用法?PHP CategoryFactory::expects怎么用?PHP CategoryFactory::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Model\CategoryFactory
的用法示例。
在下文中一共展示了CategoryFactory::expects方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
*/
protected function setUp()
{
/** @var \Magento\Framework\Registry $var */
$this->coreRegistry = $var = $this->getMockBuilder('\\Magento\\Framework\\Registry')->disableOriginalConstructor()->setMethods(['register'])->getMock();
$this->category = $this->getMockBuilder('Magento\\Catalog\\Model\\Category')->disableOriginalConstructor()->setMethods(['getId', 'setStoreId', 'load', 'getPathIds'])->getMock();
$this->categoryFactory = $this->getMockBuilder('Magento\\Catalog\\Model\\CategoryFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
$this->categoryFactory->expects($this->any())->method('create')->will($this->returnValue($this->category));
$this->store = $this->getMockBuilder('\\Magento\\Store\\Model\\Store')->disableOriginalConstructor()->setMethods(['getId'])->getMock();
$this->layer = $this->getMockBuilder('Magento\\Catalog\\Model\\Layer')->disableOriginalConstructor()->setMethods(['getCurrentStore', 'getCurrentCategory'])->getMock();
$this->layer->expects($this->any())->method('getCurrentStore')->will($this->returnValue($this->store));
$objectManagerHelper = new ObjectManagerHelper($this);
$this->target = $objectManagerHelper->getObject('Magento\\Catalog\\Model\\Layer\\Filter\\DataProvider\\Category', ['coreRegistry' => $this->coreRegistry, 'categoryFactory' => $this->categoryFactory, 'layer' => $this->layer]);
}
示例2: setUp
protected function setUp()
{
$helper = new ObjectManager($this);
$this->category = $this->getMockBuilder('Magento\\Catalog\\Model\\Category')->setMethods(['load', 'getId', '__wakeup'])->disableOriginalConstructor()->getMock();
$this->categoryFactory = $this->getMockBuilder('Magento\\Catalog\\Model\\CategoryFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
$this->categoryFactory->expects($this->any())->method('create')->will($this->returnValue($this->category));
$this->registry = $this->getMockBuilder('Magento\\Framework\\Registry')->setMethods(['registry'])->disableOriginalConstructor()->getMock();
$this->store = $this->getMockBuilder('Magento\\Store\\Model\\Store')->setMethods(['getRootCategoryId', 'getFilters', '__wakeup'])->disableOriginalConstructor()->getMockForAbstractClass();
$this->storeManager = $this->getMockBuilder('Magento\\Framework\\StoreManagerInterface')->setMethods(['getStore'])->disableOriginalConstructor()->getMockForAbstractClass();
$this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($this->store));
$this->stateKeyGenerator = $this->getMockBuilder('Magento\\Catalog\\Model\\Layer\\Category\\StateKey')->setMethods(['toString'])->disableOriginalConstructor()->getMock();
$this->collectionFilter = $this->getMockBuilder('Magento\\Catalog\\Model\\Layer\\Category\\CollectionFilter')->setMethods(['filter'])->disableOriginalConstructor()->getMock();
$this->collectionProvider = $this->getMockBuilder('Magento\\Catalog\\Model\\Layer\\ItemCollectionProviderInterface')->disableOriginalConstructor()->getMockForAbstractClass();
$this->filter = $this->getMockBuilder('Magento\\Catalog\\Model\\Layer\\Filter\\Item')->setMethods(['getFilter', 'getValueString'])->disableOriginalConstructor()->getMock();
$this->abstractFilter = $this->getMockBuilder('Magento\\Catalog\\Model\\Layer\\Filter\\AbstractFilter')->setMethods(['getRequestVar'])->disableOriginalConstructor()->getMock();
$this->context = $this->getMockBuilder('Magento\\Catalog\\Model\\Layer\\ContextInterface')->setMethods(['getStateKey', 'getCollectionFilter'])->disableOriginalConstructor()->getMockForAbstractClass();
$this->context->expects($this->any())->method('getStateKey')->will($this->returnValue($this->stateKeyGenerator));
$this->context->expects($this->any())->method('getCollectionFilter')->will($this->returnValue($this->collectionFilter));
$this->context->expects($this->any())->method('getCollectionProvider')->will($this->returnValue($this->collectionProvider));
$this->state = $this->getMockBuilder('Magento\\Catalog\\Model\\Layer\\State')->disableOriginalConstructor()->getMock();
$this->stateFactory = $this->getMockBuilder('Magento\\Catalog\\Model\\Layer\\StateFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
$this->stateFactory->expects($this->any())->method('create')->will($this->returnValue($this->state));
$this->collection = $this->getMockBuilder('Magento\\Catalog\\Model\\Resource\\Product\\Collection')->disableOriginalConstructor()->getMock();
$this->model = $helper->getObject('Magento\\Catalog\\Model\\Layer', ['registry' => $this->registry, 'categoryFactory' => $this->categoryFactory, 'storeManager' => $this->storeManager, 'context' => $this->context, 'layerStateFactory' => $this->stateFactory]);
}