public function testSaveProducts() { $resourceMock = $this->mockResource('xcom_listing/channel_product', array('saveRelations')); $resourceMock->expects($this->exactly(2))->method('saveRelations'); $product = $this->mockModel('catalog/product', array('load')); $product->expects($this->exactly(2))->method('load')->will($this->onConsecutiveCalls($this->_productOne, $this->_productTwo)); $productIds = array(1, 2); $this->_object->prepareProducts($productIds); $this->_object->setListingId('test_listing_id'); $this->_object->saveProducts(); }