/** * @param int $storeId * @param int $expected * @dataProvider getStoreIdDataProvider */ public function testGetStoreId($storeId, $expected) { if ($storeId) { $property = new \ReflectionProperty($this->item, 'storeId'); $property->setAccessible(true); $property->setValue($this->item, $storeId); } $this->assertSame($expected, $this->item->getStoreId()); }
/** * @param int $storeId * @param int $managerStoreId * @param int $expected * @dataProvider getStoreIdDataProvider */ public function testGetStoreId($storeId, $managerStoreId, $expected) { if ($storeId) { $this->setDataArrayValue('store_id', $storeId); } else { $storeManager = $this->getMock('Magento\\Store\\Model\\Store', [], [], '', false); $storeManager->expects($this->once())->method('getId')->will($this->returnValue($managerStoreId)); $this->storeManager->expects($this->once())->method('getStore')->will($this->returnValue($storeManager)); } $this->assertSame($expected, $this->item->getStoreId()); }