public function testPrepareProducts() { $product1 = new Varien_Object(array('stock_item' => new Varien_Object(array('qty' => 55.123)), 'price' => 55.178, 'id' => 1)); $product2 = new Varien_Object(array('stock_item' => new Varien_Object(array('qty' => 4)), 'price' => 5)); $productIds = array(1, 2); $productMock = $this->mockModel('catalog/product', array('load')); $productMock->expects($this->exactly(2))->method('load')->will($this->onConsecutiveCalls($product1, $product2)); $channelProduct = $this->mockModel('xcom_listing/channel_product'); $channelProduct->expects($this->once())->method('getProductMarketIds')->with($this->equalTo('test_channel_id'), $this->equalTo(array(1, 2)))->will($this->returnValue(array(1 => 10, 2 => 20))); $this->_object->setPriceType('magentoprice'); $this->_object->setQtyValueType('percent'); $this->_object->setQtyValue(10); $this->_object->setCategoryId(5); $this->_object->setChannelId('test_channel_id'); $this->assertInstanceOf(get_class($this->_object), $this->_object->prepareProducts($productIds)); $this->assertArrayHasKey('listing_price', $product1->getData()); $this->assertArrayHasKey('listing_qty', $product1->getData()); $this->assertArrayHasKey('listing_category_id', $product1->getData()); $this->assertArrayHasKey('listing_market_item_id', $product1->getData()); }