/**
  * generate the full file path for the outbound feed file.
  * @return string file path
  */
 protected function _getFeedFilePath()
 {
     $feedConfig = $this->_getFeedConfig();
     $helper = Mage::helper('ebayenterprise_catalog');
     $coreConfig = Mage::helper('eb2ccore')->getConfigModel();
     $filenameOverrides = array('store_id' => $coreConfig->setStore($this->_batch->getDefaultStore())->storeId);
     return $this->_coreFeed->getLocalDirectory() . DS . $helper->generateFileName($feedConfig[self::KEY_EVENT_TYPE], $feedConfig[self::KEY_FILE_PATTERN], $filenameOverrides);
 }
 /**
  * Create feed data set from product collection.
  * Create XML from feed data.
  * Write out file.
  * Return path to file created.
  */
 public function testBuildFeed()
 {
     $pathToFile = $this->_outboundPath . DS . $this->_tmpFileName;
     $this->_prodHelper->expects($this->once())->method('generateFileName')->will($this->returnValue($this->_tmpFileName));
     $this->_pimProductCollection->expects($this->once())->method('count')->will($this->returnValue(1));
     $this->_coreFeed->expects($this->any())->method('getLocalDirectory')->will($this->returnValue($this->_outboundPath));
     $pim = $this->getModelMockBuilder('ebayenterprise_catalog/pim')->setMethods(array('_createFeedDataSet', '_createDomFromFeedData'))->getMock();
     $pim->expects($this->any())->method('_createFeedDataSet')->will($this->returnValue($this->_pimProductCollection));
     $pim->expects($this->any())->method('_createDomFromFeedData')->will($this->returnValueMap(array(array($this->_pimProductCollection, $this->_docMock))));
     $this->_docMock->expects($this->once())->method('save')->with($this->identicalTo($pathToFile))->will($this->returnValue(12));
     // inject mocks
     $this->replaceByMock('helper', 'ebayenterprise_catalog', $this->_prodHelper);
     EcomDev_Utils_Reflection::setRestrictedPropertyValue($pim, '_coreFeed', $this->_coreFeed);
     EcomDev_Utils_Reflection::setRestrictedPropertyValue($pim, '_batch', $this->_batch);
     $this->assertSame($pathToFile, $pim->buildFeed($this->_batch));
 }