/** * @param string $storeCode * @param int $customerGroupId * @dataProvider dataProvider */ public function testIsProductVisible($storeCode, $customerGroupId) { // Complete mock of customer session /* @var $session PHPUnit_Framework_MockObject_MockObject Stub */ $mockSession = Mage::getSingleton('customer/session'); $mockSession->expects($this->any())->method('getCustomerGroupId')->will($this->returnValue($customerGroupId)); $this->setCurrentStore($storeCode); foreach (array(1, 2, 3) as $productId) { $product = $this->_getProduct($productId); $expected = $this->expected('%s-%s-%s', $storeCode, $customerGroupId, $productId)->getIsVisible(); $visible = $this->_helper->isEntityVisible($product, $customerGroupId); $message = sprintf("Visibility for product %d, store %s, customer group %s (%d) is expected to be %d but found to be %d", $productId, $storeCode, $this->_helper->getGroups()->getItemById($customerGroupId)->getCustomerGroupCode(), $customerGroupId, $expected, $visible); $this->assertEquals($expected, $visible, $message); } }