public function testGetIdentities() { $websiteId = 1; $storeId = null; $productTags = ['catalog_product_1']; $limit = 5; $storeManager = $this->getMock('Magento\\Store\\Model\\StoreManager', ['getStore'], [], '', false); $this->context->expects($this->once())->method('getStoreManager')->will($this->returnValue($storeManager)); $store = $this->getMock('Magento\\Store\\Model', ['getWebsiteId'], [], '', false); $store->expects($this->once())->method('getWebsiteId')->will($this->returnValue($websiteId)); $storeManager->expects($this->once())->method('getStore')->with($this->equalTo($storeId))->will($this->returnValue($store)); $product = $this->getMock('Magento\\Catalog\\Model\\Product', ['__wakeUp', 'getIdentities', 'getWebsiteIds'], [], '', false); $product->expects($this->once())->method('getIdentities')->will($this->returnValue($productTags)); $product->expects($this->atLeastOnce())->method('getWebsiteIds')->will($this->returnValue([$websiteId])); $item = $this->getMock('Magento\\Sales\\Model\\Resource\\Order\\Item', ['__wakeup', 'getProduct'], [], '', false); $item->expects($this->atLeastOnce())->method('getProduct')->will($this->returnValue($product)); $order = $this->getMock('Magento\\Sales\\Model\\Order', ['__wakeup', 'getParentItemsRandomCollection'], [], '', false); $order->expects($this->atLeastOnce())->method('getParentItemsRandomCollection')->with($this->equalTo($limit))->will($this->returnValue([$item])); $this->createBlockObject(); $this->assertSame($this->block, $this->block->setOrders([$order])); $this->assertEquals($productTags, $this->block->getIdentities()); }