/**
  * setUp method
  */
 public function setUp()
 {
     parent::setUp();
     $this->_origApp = EcomDev_Utils_Reflection::getRestrictedPropertyValue('Mage', '_app');
     $this->_payload = $this->getMock('eBayEnterprise\\RetailOrderManagement\\Payload\\OrderEvents\\ITestMessage');
     $this->_configMap = $this->getModelMock('ebayenterprise_amqp/config');
 }
Ejemplo n.º 2
0
 /**
  * Proxied mock instance retrieval
  *
  * @return PHPUnit_Framework_MockObject_MockObject
  */
 public function getMockInstance()
 {
     if ($this->mockInstance === null) {
         $reflection = ReflectionUtil::getReflection(ReflectionUtil::getRestrictedPropertyValue($this, 'type'));
         $this->mockInstance = $reflection->isAbstract() || $reflection->isInterface() ? $this->getMockForAbstractClass() : $this->getMock();
     }
     return $this->mockInstance;
 }
 /**
  * Store the Mage::app before tests have run.
  */
 public function setUp()
 {
     parent::setUp();
     $this->_origApp = EcomDev_Utils_Reflection::getRestrictedPropertyValue('Mage', '_app');
     // suppressing the real session from starting
     $session = $this->getModelMockBuilder('core/session')->disableOriginalConstructor()->setMethods(null)->getMock();
     $this->replaceByMock('singleton', 'core/session', $session);
 }
 protected function setUp()
 {
     $this->payloadHelper = Mage::helper('ebayenterprise_inventory/quantity_payload');
     $this->inventoryHelper = $this->getHelperMock('ebayenterprise_inventory', ['getRomSku']);
     $this->inventoryHelper->method('getRomSku')->will($this->returnArgument(0));
     // Swap out the inventory helper instance referenced by the payload helper
     // with the mock for consistent behavior during tests.
     $this->origInventoryHelper = EcomDev_Utils_Reflection::getRestrictedPropertyValue($this->payloadHelper, 'inventoryHelper');
     EcomDev_Utils_Reflection::setRestrictedPropertyValue($this->payloadHelper, 'inventoryHelper', $this->inventoryHelper);
 }
 public function setUp()
 {
     $this->helper = Mage::helper('ebayenterprise_tax');
     // Mock log context to prevent session interactions while getting log meta data.
     $logContext = $this->getHelperMock('ebayenterprise_magelog/context', ['getMetaData']);
     $logContext->method('getMetaData')->will($this->returnValue([]));
     // Swap out the log context used by the tax helper being tested, grabbing
     // a reference to the original value so it can be restored later.
     $this->origLogContext = EcomDev_Utils_Reflection::getRestrictedPropertyValue($this->helper, 'logContext');
     EcomDev_Utils_Reflection::setRestrictedPropertyValue($this->helper, 'logContext', $logContext);
 }
 /**
  * Test _getConfigMapValue method for the following expectations
  * Expectation 1: this test will invoked the method EbayEnterprise_Catalog_Model_Feed_Ack::_getConfigMapValue
  *                giving it a key for EbayEnterprise_Catalog_Model_Feed_Ack::_configMap array
  *                if this array is empty it will build it using the config registry and known class constant
  *                and then check if the given key exist in the configMap and return the value map to it
  */
 public function testGetConfigMapValue()
 {
     $cfgKey = EbayEnterprise_Catalog_Model_Feed_Ack::CFG_EXPORT_ARCHIVE;
     $configMap = array('feedExportArchive' => 'path/to/export/archive', 'feedImportArchive' => 'path/to/import/archive', 'feedOutboxDirectory' => 'path/to/outbox/directory', 'feedAckInbox' => 'path/to/ack/inbox', 'feedSentDirectory' => 'path/to/send/directory', 'ackResendTimeLimit' => 5, 'feedAckErrorDirectory' => 'path/to/ack/error/directory');
     $map = array(EbayEnterprise_Catalog_Model_Feed_Ack::CFG_EXPORT_ARCHIVE => $configMap['feedExportArchive'], EbayEnterprise_Catalog_Model_Feed_Ack::CFG_IMPORT_ARCHIVE => $configMap['feedImportArchive'], EbayEnterprise_Catalog_Model_Feed_Ack::CFG_EXPORT_OUTBOX => $configMap['feedOutboxDirectory'], EbayEnterprise_Catalog_Model_Feed_Ack::CFG_IMPORTED_ACK_DIR => $configMap['feedAckInbox'], EbayEnterprise_Catalog_Model_Feed_Ack::CFG_EXPORTED_FEED_DIR => $configMap['feedSentDirectory'], EbayEnterprise_Catalog_Model_Feed_Ack::CFG_WAIT_TIME_LIMIT => $configMap['ackResendTimeLimit'], EbayEnterprise_Catalog_Model_Feed_Ack::CFG_ERROR_DIRECTORY => $configMap['feedAckErrorDirectory']);
     $this->replaceCoreConfigRegistry($configMap);
     $ackMock = Mage::getModel('ebayenterprise_catalog/feed_ack');
     EcomDev_Utils_Reflection::setRestrictedPropertyValue($ackMock, '_configMap', []);
     $this->assertSame($map[$cfgKey], EcomDev_Utils_Reflection::invokeRestrictedMethod($ackMock, '_getConfigMapValue', array($cfgKey)));
     $this->assertSame($map, EcomDev_Utils_Reflection::getRestrictedPropertyValue($ackMock, '_configMap'));
 }
 /**
  * Constructor should load and store the PIM feed mappings from the config
  */
 public function testConstructor()
 {
     // mock mapping from the config.xml
     $mappingConfig = array('sku' => array('xml_dest' => 'Some/Xpath'));
     $defaultPimConfig = array('xml_dest' => 'ConfigurableAttributes/Attribute[@name="%s"]');
     $configRegistryMock = $this->getModelMock('eb2ccore/config_registry', array('getConfigData'));
     $configRegistryMock->expects($this->exactly(2))->method('getConfigData')->will($this->returnValueMap(array(array('ebayenterprise_catalog/feed_pim_mapping', $mappingConfig), array('ebayenterprise_catalog/default_pim_mapping', $defaultPimConfig))));
     $this->replaceByMock('model', 'eb2ccore/config_registry', $configRegistryMock);
     $factory = Mage::getModel('ebayenterprise_catalog/pim_attribute_factory');
     $this->assertSame($mappingConfig, EcomDev_Utils_Reflection::getRestrictedPropertyValue($factory, '_attributeMappings'));
     $this->assertSame($defaultPimConfig, EcomDev_Utils_Reflection::getRestrictedPropertyValue($factory, '_defaultMapping'));
 }
 /**
  * Test constructing instances - should be invoked with an array of
  * "feed details". The array of data the model is instantiated with
  * must contain keys for 'error_file' and 'doc'. When instantiated with a
  * proper set of file details, the array should be stored on the _feedDetails
  * property. When given an invalid set of file details, an error should be triggered.
  * @param array  $fileDetails  Argument to the constructor
  * @param string $errorMessage Expected error message, if empty, no error is expected
  * @dataProvider provideConstructorDetailsAndErrors
  */
 public function testConstruction($fileDetails, $errorMessage)
 {
     if ($errorMessage) {
         // Errors should be getting converted to PHPUnit_Framework_Error but
         // they aren't...instead just getting plain ol' Exceptions...so at least the
         // messages are rather explicit so hopefully no miscaught exceptions by this test.
         $this->setExpectedException('Exception', $errorMessage);
     }
     $feedFile = Mage::getModel('ebayenterprise_catalog/feed_file', $fileDetails);
     if (!$errorMessage) {
         $this->assertSame($fileDetails, EcomDev_Utils_Reflection::getRestrictedPropertyValue($feedFile, '_feedDetails'));
     }
 }
 /**
  * Test the _construct method. When valid, should result in a model with
  * a _coreFeed property. When invalid, should throw an exception.
  * @param  array   $initialData
  * @param  bool $isValid
  * @dataProvider provideConstructorInitialData
  */
 public function testConstructor($initialData, $isValid)
 {
     $coreFeed = $this->getModelMockBuilder('ebayenterprise_catalog/feed_core')->disableOriginalConstructor()->getMock();
     $this->replaceByMock('model', 'ebayenterprise_catalog/feed_core', $coreFeed);
     $feed = $this->getModelMockBuilder('ebayenterprise_catalog/feed_abstract')->disableOriginalConstructor()->setMethods(array('processDom'))->getMock();
     $feed->setData($initialData);
     if (!$isValid) {
         $this->setExpectedException('EbayEnterprise_Eb2cCore_Exception_Feed_Configuration');
     }
     EcomDev_Utils_Reflection::invokeRestrictedMethod($feed, '_construct');
     if ($isValid) {
         $this->assertSame($coreFeed, EcomDev_Utils_Reflection::getRestrictedPropertyValue($feed, '_coreFeed'));
     }
 }
Ejemplo n.º 10
0
 /**
  * A test suite ended.
  *
  * @param  PHPUnit_Framework_TestSuite $suite
  */
 public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
 {
     if (EcomDev_Utils_Reflection::getRestrictedPropertyValue($suite, 'testCase')) {
         Mage::dispatchEvent('phpunit_test_case_end_before', array('suite' => $suite, 'listener' => $this));
         EcomDev_PHPUnit_Test_Case_Util::getFixture($suite->getName())->setScope(EcomDev_PHPUnit_Model_FixtureInterface::SCOPE_SHARED)->discard();
         Mage::dispatchEvent('phpunit_test_case_end_after', array('suite' => $suite, 'listener' => $this));
     }
     if ($this->firstLevelTestSuite === $suite) {
         Mage::dispatchEvent('phpunit_suite_end_before', array('suite' => $suite, 'listener' => $this));
         $this->firstLevelTestSuite = null;
         // Discard test scope app
         if ($this->getAppReflection()->hasMethod('discardTestScope')) {
             $this->getAppReflection()->getMethod('discardTestScope')->invoke(null);
         }
         Mage::dispatchEvent('phpunit_suite_end_after', array('suite' => $suite, 'listener' => $this));
     }
 }
Ejemplo n.º 11
0
 /**
  * Constructor adds test groups defined on global level
  * and adds additional logic for test names retrieval
  *
  * @see PHPUnit_Framework_TestSuite::__construct()
  */
 public function __construct($theClass = '', $groups = array())
 {
     if (!$theClass instanceof ReflectionClass) {
         $theClass = EcomDev_Utils_Reflection::getReflection($theClass);
     }
     // Check annotations for test case name
     $annotations = PHPUnit_Util_Test::parseTestMethodAnnotations($theClass->getName());
     if (isset($annotations['name'])) {
         $this->suiteName = $annotations['name'];
     }
     // Creates all test instances
     parent::__construct($theClass);
     // Just sort-out them by our internal groups
     foreach ($groups as $group) {
         $this->groups[$group] = $this->tests();
     }
     foreach ($this->tests() as $test) {
         if ($test instanceof PHPUnit_Framework_TestSuite) {
             /* @todo
              * Post an issue into PHPUnit bugtracker for
              * impossibility for specifying group by parent test case
              * Because it is a very dirty hack :(
              **/
             $testGroups = EcomDev_Utils_Reflection::getRestrictedPropertyValue($test, 'groups');
             foreach ($groups as $group) {
                 if (!isset($testGroups[$group])) {
                     $testGroups[$group] = $test->tests();
                 } else {
                     foreach ($test->tests() as $subTest) {
                         if (!in_array($subTest, $testGroups[$group], true)) {
                             $testGroups[$group][] = $subTest;
                         }
                     }
                 }
             }
             EcomDev_Utils_Reflection::setRestrictedPropertyValue($test, 'groups', $testGroups);
         }
     }
     // Remove un grouped tests group, if it exists
     if (isset($this->groups[self::NO_GROUP_KEYWORD])) {
         unset($this->groups[self::NO_GROUP_KEYWORD]);
     }
 }
 /**
  * The protected construct method should set up an array of core feed models,
  * each loaded with the config data for one of the feed types handled by this
  * model. Using those core feed models, it should then also create an array
  * of event types used when sorting the feed files.
  */
 public function testConstruct()
 {
     $eventType = 'SomeEvent';
     $configKeys = array('itemFeed');
     $config = $this->buildCoreConfigRegistry(array('itemFeed' => array('event_type' => $eventType, 'local_directory' => 'local')));
     $prodHelper = $this->getHelperMock('ebayenterprise_catalog/data', array('getConfigModel'));
     $this->replaceByMock('helper', 'ebayenterprise_catalog', $prodHelper);
     $prodFeed = $this->getModelMockBuilder('ebayenterprise_catalog/feed')->disableOriginalConstructor()->getMock();
     // setup the feed config keys used by the product feed model so only some
     // expected subset of the feed types are worked with
     EcomDev_Utils_Reflection::setRestrictedPropertyValue($prodFeed, '_feedConfigKeys', $configKeys);
     $prodHelper->expects($this->once())->method('getConfigModel')->will($this->returnValue($config));
     $coreFeed = $this->getModelMockBuilder('ebayenterprise_catalog/feed_core')->disableOriginalConstructor()->setMethods(array('getEventType'))->getMock();
     $this->replaceByMock('model', 'ebayenterprise_catalog/feed_core', $coreFeed);
     $coreFeed->expects($this->once())->method('getEventType')->will($this->returnValue($eventType));
     EcomDev_Utils_Reflection::invokeRestrictedMethod($prodFeed, '_construct');
     $this->assertSame(array($eventType), EcomDev_Utils_Reflection::getRestrictedPropertyValue($prodFeed, '_eventTypes'));
     $this->assertSame(array($coreFeed), EcomDev_Utils_Reflection::getRestrictedPropertyValue($prodFeed, '_coreFeedTypes'));
 }
 public function setUp()
 {
     parent::setUp();
     // keep a backup copy of all websites
     $this->_oldWebsites = EcomDev_Utils_Reflection::getRestrictedPropertyValue(Mage::app(), '_websites');
     // mock up a store for the default website
     $this->_defaultStore = $this->getModelMockBuilder('core/store')->disableOriginalConstructor()->setMethods(array('getId'))->getMock();
     $this->_defaultStore->expects($this->any())->method('getId')->will($this->returnValue(0));
     $this->_defaultStores = array(0 => $this->_defaultStore);
     // mock up a store for the non default website
     $this->_store1 = $this->getModelMockBuilder('core/store')->disableOriginalConstructor()->setMethods(array('getId'))->getMock();
     $this->_store1->expects($this->any())->method('getId')->will($this->returnValue(1));
     $this->_store2 = $this->getModelMockBuilder('core/store')->disableOriginalConstructor()->setMethods(array('getId'))->getMock();
     $this->_store2->expects($this->any())->method('getId')->will($this->returnValue(2));
     $this->_web1Stores = array(1 => $this->_store1, 2 => $this->_store2);
     // mock replacement websites with the store to use as the default.
     $this->_website1 = $this->_stubWebsite(1, 'web1', $this->_store1);
     $this->_defaultWebsite = $this->_stubWebsite(0, 'admin', $this->_defaultStore);
     $this->_defaultWebsite->addData(Mage::app()->getWebsite(0)->getData());
     $this->_batchContainer = $this->getModelMock('ebayenterprise_catalog/pim_batch_container', array('addBatch'));
     $cutoffDate = 'a date string';
     $this->_eventObserver = $this->_buildEventObserver(array('cutoff_date' => $cutoffDate, 'container' => $this->_batchContainer, 'feed_type_config' => $this->_feedConfig));
     $this->_collectionDefault = $this->getResourceModelMock('catalog/product_collection', array('load', 'addWebsiteFilter', 'getColumnValues', 'addFieldToFilter'));
     $this->_collectionWeb1 = $this->getResourceModelMock('catalog/product_collection', array('load', 'addWebsiteFilter', 'getColumnValues', 'addFieldToFilter'));
     // setup which website filters will return which set of product ids.
     $this->_websiteFilterValueMap = array(array(array(0), $this->_collectionDefault), array(array(1), $this->_collectionWeb1));
     // stub the language helper to return stores for each website
     $this->_getWebsiteStoresValueMap = array(array($this->_defaultWebsite, null, $this->_defaultStores), array($this->_website1, null, $this->_web1Stores));
     $this->_languageHelper = $this->getHelperMock('eb2ccore/languages', array('getWebsiteStores'));
     $this->_languageHelper->expects($this->any())->method('getWebsiteStores')->will($this->returnValueMap($this->_getWebsiteStoresValueMap));
     $cutoffFilter = array('gteq' => $cutoffDate);
     foreach (array($this->_collectionDefault, $this->_collectionWeb1) as $collectionMock) {
         $collectionMock->expects($this->any())->method('addWebsiteFilter')->will($this->returnValueMap($this->_websiteFilterValueMap));
         $collectionMock->expects($this->any())->method('load')->will($this->returnSelf());
         $collectionMock->expects($this->any())->method('addFieldToFilter')->with($this->identicalTo('updated_at'), $this->identicalTo($cutoffFilter))->will($this->returnSelf());
     }
 }
 /**
  * Test that the method ebayenterprise_order/cancel::_sendRequest()
  * is invoked, and it will instantiate the class ebayenterprise_order/cancel_send_request
  * passing to its constructor method an array with key 'request' mapped to a
  * IOrderCancelRequest payload object. Then, it will invoke the method
  * ebayenterprise_order/cancel_send_request::send(), which will return an instance
  * of type IOrderCancelResponse. This instance of type IOrderCancelResponse will be
  * assigned to the class property ebayenterprise_order/cancel::$_response.
  * Finally, the method ebayenterprise_order/cancel::_sendRequest() will return itself.
  */
 public function testOrderCancelSendRequest()
 {
     /** @var Mage_Sales_Model_Order */
     $order = Mage::getModel('sales/order');
     /** @var Mock_IOrderCancelRequest */
     $request = $this->getMockBuilder(EbayEnterprise_Order_Model_Cancel_Build_IRequest::PAYLOAD_CLASS)->disableOriginalConstructor()->getMock();
     /** @var Mock_IOrderCancelResponse */
     $response = $this->getMockBuilder(static::RESPONSE_CLASS)->disableOriginalConstructor()->getMock();
     /** @var EbayEnterprise_Order_Model_Cancel_Send_Request */
     $cancelSendRequest = $this->getModelMock('ebayenterprise_order/cancel_send_request', ['send'], false, [['api' => $this->_api, 'request' => $request]]);
     $cancelSendRequest->expects($this->once())->method('send')->will($this->returnValue($response));
     /** @var EbayEnterprise_Order_Helper_Factory */
     $factory = $this->getHelperMock('ebayenterprise_order/factory', ['getNewCancelSendRequest']);
     $factory->expects($this->once())->method('getNewCancelSendRequest')->with($this->identicalTo($this->_api), $this->identicalTo($request))->will($this->returnValue($cancelSendRequest));
     /** @var Mock_EbayEnterprise_Order_Model_Cancel */
     $cancel = $this->getModelMock('ebayenterprise_order/cancel', ['foo'], false, [['order' => $order, 'factory' => $factory, 'core_helper' => $this->_coreHelper, 'order_cfg' => $this->_orderCfg]]);
     // Set the class property ebayenterprise_order/cancel::$_api to a known state
     EcomDev_Utils_Reflection::setRestrictedPropertyValue($cancel, '_api', $this->_api);
     // Set the class property ebayenterprise_order/cancel::$_request to mock of IOrderCancelRequest.
     EcomDev_Utils_Reflection::setRestrictedPropertyValue($cancel, '_request', $request);
     // Proving that initial state of the class property ebayenterprise_order/cancel::$_response is null.
     $this->assertNull(EcomDev_Utils_Reflection::getRestrictedPropertyValue($cancel, '_response'));
     $this->assertSame($cancel, EcomDev_Utils_Reflection::invokeRestrictedMethod($cancel, '_sendRequest', []));
     // Proving that after invoking the method ebayenterprise_order/cancel::_sendRequest()
     // the class property ebayenterprise_order/cancel::$_response is now
     // an instance of IOrderCancelResponse.
     $this->assertSame($response, EcomDev_Utils_Reflection::getRestrictedPropertyValue($cancel, '_response'));
 }
 /**
  * Test getCustomAttributeCodeSet the feed
  */
 public function testGetCustomAttributeCodeSet()
 {
     $apiModelMock = $this->getModelMockBuilder('catalog/product_attribute_api')->disableOriginalConstructor()->setMethods(array('items'))->getMock();
     $apiModelMock->expects($this->once())->method('items')->with($this->equalTo(172))->will($this->returnValue(array(array('code' => 'brand_name'), array('code' => 'brand_description'), array('code' => 'is_drop_shipped'), array('code' => 'drop_ship_supplier_name'))));
     $this->replaceByMock('model', 'catalog/product_attribute_api', $apiModelMock);
     $helper = Mage::helper('ebayenterprise_catalog');
     // setting _customAttributeCodeSets property back to an empty array
     EcomDev_Utils_Reflection::setRestrictedPropertyValue($helper, '_customAttributeCodeSets', array());
     $this->assertSame(array('brand_name', 'brand_description', 'is_drop_shipped', 'drop_ship_supplier_name'), Mage::helper('ebayenterprise_catalog')->getCustomAttributeCodeSet(172));
     $this->assertSame(array(172 => array('brand_name', 'brand_description', 'is_drop_shipped', 'drop_ship_supplier_name')), EcomDev_Utils_Reflection::getRestrictedPropertyValue($helper, '_customAttributeCodeSets'));
     // resetting _customAttributeCodeSets property back to an empty array
     EcomDev_Utils_Reflection::setRestrictedPropertyValue($helper, '_customAttributeCodeSets', array());
 }
 /**
  * Test dispatching an appropriate event for a given payload
  */
 public function testDispatchPayloadEvents()
 {
     $this->_payload->expects($this->any())->method('getEventType')->will($this->returnValue('UnitTestMessageType'));
     $store = Mage::getModel('core/store');
     $runner = Mage::getModel('ebayenterprise_amqp/runner');
     EcomDev_Utils_Reflection::invokeRestrictedMethod($runner, '_dispatchPayload', array($this->_payload, $store));
     $prefix = EcomDev_Utils_Reflection::getRestrictedPropertyValue($runner, '_eventPrefix');
     $this->assertEventDispatched($prefix . '_unit_test_message_type');
 }
Ejemplo n.º 17
0
 protected function setUp()
 {
     // Retrieve existing helpers and store them for future revert
     $this->initializedHelpers = EcomDev_Utils_Reflection::getRestrictedPropertyValue('EcomDev_PHPUnit_Helper', 'helpers');
     $this->resetHelpers();
 }
 /**
  * Test constructing the PIM Model passing it dependencies. Should expect the
  * core feed model to be completely intialized - never call _setUpCoreFeed
  */
 public function testConstructorWithArgs()
 {
     $pim = $this->getModelMockBuilder('ebayenterprise_catalog/pim')->disableOriginalConstructor()->setMethods(null)->getMock();
     $pim->__construct(array('doc' => $this->_doc, 'core_feed' => $this->_coreFeed, 'batch' => $this->_batch));
     $this->assertSame($this->_doc, EcomDev_Utils_Reflection::getRestrictedPropertyValue($pim, '_doc'));
     $this->assertSame($this->_coreFeed, EcomDev_Utils_Reflection::getRestrictedPropertyValue($pim, '_coreFeed'));
     $this->assertSame($this->_batch, EcomDev_Utils_Reflection::getRestrictedPropertyValue($pim, '_batch'));
 }
 /**
  * set the status handler path
  */
 public function testSetStatusHandlerPath()
 {
     $api = Mage::getModel('eb2ccore/api');
     $this->assertSame($api, $api->setStatusHandlerPath('some/path'));
     $this->assertSame('some/path', EcomDev_Utils_Reflection::getRestrictedPropertyValue($api, '_statusHandlerPath'));
 }
Ejemplo n.º 20
0
 /**
  * Replace registry item value
  *
  * @param string $key
  * @param string $value
  * @return $this
  */
 public function replaceRegistry($key, $value)
 {
     $registry = EcomDev_Utils_Reflection::getRestrictedPropertyValue('Mage', '_registry');
     $registry[$key] = $value;
     EcomDev_Utils_Reflection::setRestrictedPropertyValue('Mage', '_registry', $registry);
     return $this;
 }
 /**
  *
  */
 protected function setUp()
 {
     $this->container = Mage::getModel('hackathon_fixturegenerator/generator_container');
     $this->originalGenerators = EcomDev_Utils_Reflection::getRestrictedPropertyValue('Hackathon_FixtureGenerator_Model_Generator_Container', 'generators');
     EcomDev_Utils_Reflection::setRestrictedPropertyValue('Hackathon_FixtureGenerator_Model_Generator_Container', 'generators', array());
 }
    /**
     * Test flush method with the following assumptions when called
     * Expectation 1: in order to fully test the EbayEnterprise_Catalog_Model_Error_Confirmations::flush method we need to set
     *                the class property EbayEnterprise_Catalog_Model_Error_Confirmations::_queueConfirmation to a known states with array with elements
     * Expectation 2: since the test set the class property _queueConfirmation to an array with one element we expect that the class method
     *                EbayEnterprise_Catalog_Model_Error_Confirmations::append will be called once with the content of the first array element and return itself
     * Expectation 3: the method EbayEnterprise_Catalog_Model_Error_Confirmations::flush is expected to return itself as expected
     * Expectation 4: the class property EbayEnterprise_Catalog_Model_Error_Confirmations::_queueConfirmation is expected to be an empty array.
     * @mock EbayEnterprise_Catalog_Model_Error_Confirmations::append
     */
    public function testFlush()
    {
        $confirmationsModelMock = $this->getModelMockBuilder('ebayenterprise_catalog/error_confirmations')->disableOriginalConstructor()->setMethods(array('append'))->getMock();
        $confirmationsModelMock->expects($this->once())->method('append')->with($this->equalTo('<ErrorConfirmation unique_id="SK-ABC-1334">
<Error event_type="ItemMaster" file_name="ItemMaster_TestSubset.xml" reported_from="WMS">
				<Message xml:lang="en-US" code="">Error exception occurred: UnitTest Simulate Throw Exception on Dom load</Message>
			</Error>
	</ErrorConfirmation>'))->will($this->returnSelf());
        // class property _queueConfirmation to a known state
        EcomDev_Utils_Reflection::setRestrictedPropertyValue($confirmationsModelMock, '_queueConfirmation', array('<ErrorConfirmation unique_id="SK-ABC-1334">
<Error event_type="ItemMaster" file_name="ItemMaster_TestSubset.xml" reported_from="WMS">
				<Message xml:lang="en-US" code="">Error exception occurred: UnitTest Simulate Throw Exception on Dom load</Message>
			</Error>
	</ErrorConfirmation>'));
        $this->assertSame($confirmationsModelMock, $confirmationsModelMock->flush());
        $this->assertEmpty(EcomDev_Utils_Reflection::getRestrictedPropertyValue($confirmationsModelMock, '_queueConfirmation'));
    }