/**
  * Test getting the operation type for a product based on when the product
  * was created. If the product was created after the last run of the export,
  * found via a config value, the operation type should be "Add". Otherwise,
  * the operation type should be "Change".
  */
 public function testPassOperationType()
 {
     // As this is a pseudo-product attribute, the value will be empty and the
     // attribute code should will begin with an '_'
     $attributeValue = '';
     $attributeCode = '_operation_type';
     // These time formats match the formats actually being used.
     $addProduct = Mage::getModel('catalog/product', array('created_at' => '2014-02-02 00:00:00'));
     $changeProduct = Mage::getModel('catalog/product', array('created_at' => '2014-01-01 00:00:00'));
     // Any products created after this time should get "Add" operation type,
     // any created before should get "Change" operation type
     $lastRunTime = '2014-01-15T00:00:00+00:00';
     $doc = new EbayEnterprise_Dom_Document();
     $addAttr = $doc->createAttribute('operation_type');
     $addAttr->value = 'Add';
     $changeAttr = $doc->createAttribute('operation_type');
     $changeAttr->value = 'Change';
     // Stub out the config registry and helper that delivers it so a known
     // last run time can be reliably returned.
     $cfg = $this->buildCoreConfigRegistry(array('pimExportFeedCutoffDate' => $lastRunTime));
     $prodHelper = $this->getHelperMock('ebayenterprise_catalog/data', array('getConfigModel'));
     $prodHelper->expects($this->any())->method('getConfigModel')->will($this->returnValue($cfg));
     $this->replaceByMock('helper', 'ebayenterprise_catalog', $prodHelper);
     $changeResult = Mage::helper('ebayenterprise_catalog/pim')->passOperationType($attributeValue, $attributeCode, $changeProduct, $doc);
     $this->assertSame('Change', $changeResult->value);
     $this->assertSame('operation_type', $changeResult->name);
     $addResult = Mage::helper('ebayenterprise_catalog/pim')->passOperationType($attributeValue, $attributeCode, $addProduct, $doc);
     $this->assertSame('Add', $addResult->value);
     $this->assertSame('operation_type', $addResult->name);
 }