public function setUp()
 {
     parent::setUp();
     // suppressing the real session from starting
     $session = $this->getModelMockBuilder('core/session')->disableOriginalConstructor()->setMethods(null)->getMock();
     $this->replaceByMock('singleton', 'core/session', $session);
 }
 public function setUp()
 {
     parent::setUp();
     $this->logger = $this->getHelperMockBuilder('ebayenterprise_magelog/data')->disableOriginalConstructor()->getMock();
     $this->logContext = $this->getHelperMockBuilder('ebayenterprise_magelog/context')->disableOriginalConstructor()->getMock();
     $this->logContext->expects($this->any())->method('getMetaData')->will($this->returnValue([]));
 }
 /**
  * prepare stubs
  */
 public function setUp()
 {
     parent::setUp();
     $this->_httpApi = $this->getMockBuilder('\\eBayEnterprise\\RetailOrderManagement\\Api\\HttpApi')->disableOriginalConstructor()->getMock();
     $this->_observerStub = $this->getModelMock('ebayenterprise_order/observer');
     $this->_itemSelection = $this->getHelperMock('ebayenterprise_order/item_selection', ['selectFrom']);
     $this->_payloadFactory = new PayloadFactory();
     $this->_request = $this->_payloadFactory->buildPayload('\\eBayEnterprise\\RetailOrderManagement\\Payload\\Order\\OrderCreateRequest');
     $this->_requestStub = $this->getMock('\\eBayEnterprise\\RetailOrderManagement\\Payload\\Order\\IOrderCreateRequest');
     $this->_replyStub = $this->getMock('\\eBayEnterprise\\RetailOrderManagement\\Payload\\Order\\IOrderCreateReply');
     $this->_coreHelperStub = $this->getHelperMock('eb2ccore/data', ['generateRequestId', 'getConfigModel']);
     $coreConfig = $this->buildCoreConfigRegistry(['clientCustomerIdPrefix' => $this->_clientCustomerIdPrefix, 'language_code' => 'en-us', 'clientCustomerIdLength' => 0]);
     $this->_coreHelperStub->expects($this->any())->method('getConfigModel')->will($this->returnValue($coreConfig));
     $this->_config = $this->buildCoreConfigRegistry(['levelOfService' => $this->_expectedLevelOfService, 'orderType' => $this->_expectedOrderType, 'requestIdPrefix' => $this->_expectedRequestIdPrefix, 'apiCreateOperation' => 'create', 'apiService' => 'orders', 'genderMap' => ['Female' => 'F', 'Male' => 'M', 'SomeOtherGender' => 'Invalid']]);
     $this->_orderHelperStub = $this->getHelperMock('ebayenterprise_order', ['prefixCustomerId']);
     // Mock the customer id prefixing method to return the customer id
     // prefixed with the constant client customer id prefix.
     $clientCustomerIdPrefix = $this->_clientCustomerIdPrefix;
     $this->_orderHelperStub->method('prefixCustomerId')->will($this->returnCallback(function ($id) use($clientCustomerIdPrefix) {
         return $clientCustomerIdPrefix . $id;
     }));
     $this->_customer = Mage::getModel('customer/customer', ['increment_id' => '12345123456789']);
     $this->_order = Mage::getModel('sales/order', ['created_at' => '2014-07-28 16:22:46', 'customer' => $this->_customer, 'customer_dob' => '2014-07-28 16:22:46', 'customer_email' => '*****@*****.**', 'customer_firstname' => 'fname', 'customer_lastname' => 'lname', 'customer_middlename' => 'mname', 'customer_prefix' => 'mr', 'customer_id' => '123456789', 'customer_taxvat' => 'taxid', 'increment_id' => '12345123456789']);
     $this->_item1 = $this->getModelMock('sales/order_item', []);
     $this->_item2 = $this->getModelMock('sales/order_item', []);
     $this->_billAddress = Mage::getModel('sales/order_address', ['address_type' => Mage_Customer_Model_Address_Abstract::TYPE_BILLING, 'entity_id' => $this->_billAddressId]);
     $this->_shipAddress = Mage::getModel('sales/order_address', ['address_type' => Mage_Customer_Model_Address_Abstract::TYPE_SHIPPING, 'entity_id' => $this->_shipAddressId]);
     // Mock log context to prevent session interactions while building out log data.
     $this->_logContext = $this->getHelperMock('ebayenterprise_magelog/context', ['getMetaData']);
     $this->_logContext->method('getMetaData')->will($this->returnValue([]));
     // prevent magento events from actually triggering
     Mage::app()->disableEvents();
 }
 /**
  * Set up dependent systems for the tests
  */
 public function setUp()
 {
     parent::setUp();
     $this->doc = Mage::helper('eb2ccore')->getNewDomDocument();
     $this->product = Mage::getModel('catalog/product');
     // setup parent config and used simple products
     $configId = 1;
     $configSku = sprintf('%s-%s', $this->catalogId, $this->styleId);
     $simpleId = 2;
     $simpleSku = sprintf('%s-%s', $this->catalogId, 'SIMPLE1');
     $this->configProduct = Mage::getModel('catalog/product', array('type_id' => Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE, 'sku' => $configSku, 'entity_id' => $configId));
     $this->simpleProduct = Mage::getModel('catalog/product', array('type_id' => Mage_Catalog_Model_Product_Type::TYPE_SIMPLE, 'sku' => $simpleSku, 'entity_id' => $simpleId));
     // mock out the resource model used to lookup the config to simple
     // product relationships so lookups can be avoided and made reliable
     $this->configTypeResource = $this->getResourceModelMock('catalog/product_type_configurable', array('getParentIdsByChild'));
     // script out lookup behavior - when called with the simple product's id,
     // return array containing config product's id and an empty array otherwise
     $this->configTypeResource->expects($this->any())->method('getParentIdsByChild')->will($this->returnCallback(function ($childId) use($configId, $simpleId) {
         return $childId === $simpleId ? array($configId) : array();
     }));
     // mock out catalog id config
     $this->coreConfig = $this->buildCoreConfigRegistry(array('catalogId' => $this->catalogId));
     $this->coreHelper = $this->getHelperMock('eb2ccore/data', array('getConfigModel'));
     $this->coreHelper->expects($this->any())->method('getConfigModel')->will($this->returnValue($this->coreConfig));
 }
 /**
  * Set up mock and test objects used throughout the tests.
  */
 public function setUp()
 {
     parent::setUp();
     $this->product = Mage::getModel('catalog/product');
     $configId = 1;
     $configSku = sprintf('%s-%s', $this->catalogId, $this->styleId);
     $simpleId = 2;
     $simpleSku = sprintf('%s-%s', $this->catalogId, 'SIMPLE1');
     $this->configProduct = Mage::getModel('catalog/product', array('type_id' => Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE, 'sku' => $configSku, 'name' => sprintf($this->styleName), 'entity_id' => $configId));
     $this->simpleProduct = Mage::getModel('catalog/product', array('type_id' => Mage_Catalog_Model_Product_Type::TYPE_SIMPLE, 'sku' => $simpleSku, 'name' => 'Simple Product', 'entity_id' => $simpleId));
     // mock out the resource model used to lookup the config to simple
     // product relationships so lookups can be avoided and made reliable
     $this->configTypeResource = $this->getResourceModelMock('catalog/product_type_configurable', array('getParentIdsByChild'));
     // script out lookup behavior - when called with the simple product's id,
     // return array containing config product's id and an empty array otherwise
     $this->configTypeResource->expects($this->any())->method('getParentIdsByChild')->will($this->returnCallback(function ($childId) use($configId, $simpleId) {
         return $childId === $simpleId ? array($configId) : array();
     }));
     $this->colorOption = Mage::getModel('eav/entity_attribute_option');
     $this->colorOption->setData($this->colorData);
     $this->colorOptionCollection = $this->getResourceModelMockBuilder('eav/entity_attribute_option_collection')->disableOriginalConstructor()->setMethods(array('getItemById'))->getMock();
     $this->colorOptionCollection->expects($this->any())->method('getItemById')->will($this->returnValueMap(array(array($this->colorData['id'], $this->colorOption))));
     $this->doc = new EbayEnterprise_Dom_Document();
     $this->coreConfig = $this->buildCoreConfigRegistry(array('catalogId' => $this->catalogId));
     $this->coreHelper = $this->getHelperMock('eb2ccore/data', array('getConfigModel'));
     $this->coreHelper->expects($this->any())->method('getConfigModel')->will($this->returnValue($this->coreConfig));
     $this->itemmasterHelper = $this->getHelperMock('ebayenterprise_catalog/itemmaster', array('_getColorAttributeOptionsCollection'));
     $this->itemmasterHelper->expects($this->any())->method('_getColorAttributeOptionsCollection')->will($this->returnValue($this->colorOptionCollection));
 }
 public function setUp()
 {
     parent::setUp();
     $this->giftCardStorage = new SplObjectStorage();
     $this->session = $this->getModelMockBuilder('ebayenterprise_giftcard/session')->disableOriginalConstructor()->setMethods(null)->getMock();
     $this->giftCardContainer = Mage::getModel('ebayenterprise_giftcard/container', ['gift_card_storage' => $this->giftCardStorage, 'session' => $this->session]);
     $this->giftCardHelper = Mage::helper('ebayenterprise_giftcard');
 }
 public function setUp()
 {
     parent::setUp();
     $this->_replaceSession('core/session');
     $this->_item = Mage::getModel('sales/order_item');
     // get a pricegroup payload
     $this->_payload = Mage::helper('eb2ccore')->getSdkApi('orders', 'create')->getRequestBody()->getOrderItems()->getEmptyOrderItem()->getEmptyPriceGroup();
 }
 /**
  * setUp method
  */
 public function setUp()
 {
     parent::setUp();
     $this->_jsModuleName = EbayEnterprise_Eb2cFraud_Helper_Http::JSC_JS_PATH;
     $this->_requestStub = $this->getMock('Mage_Core_Controller_Request_Http', ['getServer', 'getCookie', 'getPost']);
     $this->_requestStub->expects($this->any())->method('getServer')->will($this->returnValue('arequestvalue'));
     $this->_requestStub->expects($this->any())->method('getCookie')->will($this->returnValue(['foo' => 'bar', 'foo1' => 'bar1']));
     $this->_requestStub->expects($this->any())->method('getPost')->will($this->returnValueMap([['eb2cszyvl', '', 'random_field_name'], ['random_field_name', '', 'javascript_data']]));
     $this->_cookieStub = $this->getModelMock('core/cookie', ['_getRequest', 'get']);
     $this->_cookieStub->expects($this->any())->method('_getRequest')->will($this->returnValue($this->_requestStub));
 }
 public function setUp()
 {
     parent::setUp();
     $this->_payloadFactory = new PayloadFactory();
     $this->_payload = $this->_payloadFactory->buildPayload('\\eBayEnterprise\\RetailOrderManagement\\Payload\\OrderEvents\\OrderCreditIssued');
     $this->_payload->setCustomerOrderId(static::PAYLOAD_CUSTOMER_ORDER_ID)->setStoreId(static::PAYLOAD_STORE_ID)->setCurrencyCode(static::PAYLOAD_CURRENCY_CODE)->setCurrencySymbol(static::PAYLOAD_CURRENCY_SYMBOL);
     // suppressing the real session from starting
     $session = $this->getModelMockBuilder('core/session')->disableOriginalConstructor()->setMethods(null)->getMock();
     $this->replaceByMock('singleton', 'core/session', $session);
     $this->_creditissued = Mage::getModel('ebayenterprise_order/creditissued', ['payload' => $this->_payload]);
 }
 public function setUp()
 {
     parent::setUp();
     $this->locale = $this->getModelMock('core/locale', ['getLocale', 'getLocaleCode']);
     $zendLocale = $this->getMockBuilder('Zend_Locale')->disableOriginalConstructor()->setMethods(['getRegion'])->getMock();
     $this->locale->expects($this->any())->method('getLocale')->will($this->returnValue($zendLocale));
     $zendLocale->expects($this->any())->method('getRegion')->will($this->returnValue('US'));
     $this->locale->expects($this->any())->method('getLocaleCode')->will($this->returnValue('en_US'));
     $this->block = new EbayEnterprise_PayPal_Block_Payment_Mark();
     $this->block->setLocale($this->locale);
 }
 public function setUp()
 {
     parent::setUp();
     $this->_payload = new OrderEvents\OrderRejected(new Payload\ValidatorIterator([$this->getMock('\\eBayEnterprise\\RetailOrderManagement\\Payload\\IValidator')]), $this->getMock('\\eBayEnterprise\\RetailOrderManagement\\Payload\\ISchemaValidator'), $this->getMock('\\eBayEnterprise\\RetailOrderManagement\\Payload\\IPayloadMap'), new NullLogger());
     $this->_payload->setCustomerOrderId(static::PAYLOAD_CUSTOMER_ORDER_ID)->setStoreId(static::PAYLOAD_STORE_ID)->setOrderCreateTimestamp(new DateTime(static::PAYLOAD_ORDER_CREATE_TIMESTAMP))->setReason(static::PAYLOAD_REASON)->setCode(static::PAYLOAD_CODE);
     // suppressing the real session from starting
     $session = $this->getModelMockBuilder('core/session')->disableOriginalConstructor()->setMethods(null)->getMock();
     $this->replaceByMock('singleton', 'core/session', $session);
     $this->_eventHelper = $this->getHelperMock('ebayenterprise_order/event', ['attemptCancelOrder']);
     $this->_orderrejected = Mage::getModel('ebayenterprise_order/orderrejected', ['payload' => $this->_payload, 'order_event_helper' => $this->_eventHelper]);
 }
 public function setUp()
 {
     parent::setUp();
     $this->_payloadFactory = new PayloadFactory();
     $this->_payload = $this->_payloadFactory->buildPayload('\\eBayEnterprise\\RetailOrderManagement\\Payload\\OrderEvents\\OrderShipped');
     $this->_payload->deserialize(file_get_contents(__DIR__ . '/ShipmentTest/fixtures/OrderShipped.xml'));
     // suppressing the real session from starting
     $session = $this->getModelMockBuilder('core/session')->disableOriginalConstructor()->setMethods(null)->getMock();
     $this->replaceByMock('singleton', 'core/session', $session);
     $this->_shipmentHelper = Mage::helper('ebayenterprise_order/event_shipment');
 }
 public function setUp()
 {
     parent::setUp();
     $this->_payloadFactory = new PayloadFactory();
     $this->_payload = $this->_payloadFactory->buildPayload('\\eBayEnterprise\\RetailOrderManagement\\Payload\\OrderEvents\\OrderShipped');
     $this->_payload->setCustomerOrderId(static::PAYLOAD_CUSTOMER_ORDER_ID)->setStoreId(static::PAYLOAD_STORE_ID);
     // suppressing the real session from starting
     $session = $this->getModelMockBuilder('core/session')->disableOriginalConstructor()->setMethods(null)->getMock();
     $this->replaceByMock('singleton', 'core/session', $session);
     $this->_shipmentHelper = $this->getHelperMock('ebayenterprise_order/event_shipment', ['process']);
     $this->_ordershipped = Mage::getModel('ebayenterprise_order/ordershipped', ['payload' => $this->_payload, 'shipment_event_helper' => $this->_shipmentHelper]);
 }
 public function setUp()
 {
     parent::setUp();
     // stub the customer session
     $this->_customerSessionStub = $this->getModelMockBuilder('customer/session')->disableOriginalConstructor()->setMethods(['isLoggedIn', 'getEncryptedSessionId'])->getMock();
     $this->_customerSessionStub->expects($this->any())->method('getEncryptedSessionId')->will($this->returnValue('sessionid'));
     $this->_storeStub = $this->getModelMockBuilder('core/store')->disableOriginalConstructor()->setMethods(['isAdmin'])->getMock();
     $this->_coreHelperStub = $this->getHelperMock('eb2ccore/data', ['getCurrentStore']);
     $this->_coreHelperStub->expects($this->any())->method('getCurrentStore')->will($this->returnValue($this->_storeStub));
     $this->_orderStub = $this->getModelMock('sales/order', ['getId']);
     $this->_payload = Mage::helper('eb2ccore')->getSdkApi('orders', 'create')->getRequestBody();
 }
 public function setUp()
 {
     parent::setUp();
     $this->logger = $this->getHelperMockBuilder('ebayenterprise_magelog/data')->disableOriginalConstructor()->getMock();
     $this->logContext = $this->getHelperMockBuilder('ebayenterprise_magelog/context')->disableOriginalConstructor()->getMock();
     $this->logContext->expects($this->any())->method('getMetaData')->will($this->returnValue([]));
     $this->request = $this->getMockForAbstractClass('\\eBayEnterprise\\RetailOrderManagement\\Payload\\Inventory\\IAllocationRollbackRequest');
     $this->reply = $this->getMockForAbstractClass('\\eBayEnterprise\\RetailOrderManagement\\Payload\\Inventory\\IAllocationRollbackReply');
     $this->httpApi = $this->getMockBuilder('\\eBayEnterprise\\RetailOrderManagement\\Api\\IBidirectionalApi')->disableOriginalConstructor()->setMethods(['send', 'getRequestBody', 'getResponseBody', 'setRequestBody'])->getMock();
     $this->httpApi->expects($this->any())->method('setRequestBody')->with($this->isInstanceOf('\\eBayEnterprise\\RetailOrderManagement\\Payload\\Inventory\\IAllocationRollbackRequest'))->will($this->returnSelf());
     $this->httpApi->expects($this->any())->method('getRequestBody')->will($this->returnValue($this->request));
     $this->httpApi->expects($this->any())->method('getResponseBody')->will($this->returnValue($this->reply));
 }
 public function setUp()
 {
     parent::setUp();
     $this->_order = Mage::getModel('sales/order');
     $this->_item = Mage::getModel('sales/order_item');
     $this->_helperMock = $this->getHelperMock('eb2cgiftwrap/data');
     $this->_messageMock = $this->getModelMock('giftmessage/message', array('load'));
     $this->_giftwrappingMock = $this->getModelMock('enterprise_giftwrapping/wrapping', array('load'));
     $this->_payloadFactory = new PayloadFactory();
     // This payload will be the source of all sub-payloads handled. Any gifting
     // subpayloads to be tested should come from it.
     $this->_orderCreateRequest = $this->_payloadFactory->buildPayload('\\eBayEnterprise\\RetailOrderManagement\\Payload\\Order\\OrderCreateRequest');
 }
 public function setUp()
 {
     parent::setUp();
     $this->_store = $this->getModelMockBuilder('core/store')->disableOriginalConstructor()->setMethods(array('getId'))->getMock();
     $this->_store->expects($this->any())->method('getId')->will($this->returnValue(0));
     $this->_stores = array(0 => $this->_store);
     $this->_collection = $this->getResourceModelMock('catalog/product_collection', array('load', 'addFieldToFilter'));
     $this->_batchContainer = $this->getModelMock('ebayenterprise_catalog/pim_batch_container', array('addBatch'));
     $this->_langHelper = $this->getHelperMock('eb2ccore/languages', array('getStores'));
     $this->_langHelper->expects($this->any())->method('getStores')->will($this->returnValue($this->_stores));
     $this->_prodHelper = $this->getHelperMock('ebayenterprise_catalog/data', array('getDefaultStoreViewId'));
     $this->_prodHelper->expects($this->any())->method('getDefaultStoreViewId')->will($this->returnValue(0));
 }
 public function setUp()
 {
     parent::setUp();
     // Prevent log context from needing session while gather context data for logging.
     $this->logContext = $this->getHelperMock('ebayenterprise_magelog/context', ['getMetaData']);
     $this->logContext->method('getMetaData')->will($this->returnValue([]));
     $this->api = $this->getMock('\\eBayEnterprise\\RetailOrderManagement\\Api\\IBidirectionalApi');
     $this->configModel = $this->buildCoreConfigRegistry(['apiService' => 'inventory', 'apiOperation' => 'allocate']);
     $this->helper = $this->getHelperMock('ebayenterprise_inventory');
     $this->helper->method('getConfigModel')->will($this->returnValue($this->configModel));
     $this->coreHelper = $this->getHelperMock('eb2ccore', ['getSdkApi']);
     $this->coreHelper->method('getSdkApi')->will($this->returnValue($this->api));
 }
 public function setUp()
 {
     parent::setUp();
     $this->payload = $this->mockPayload();
     $detail = $this->getModelMockBuilder('ebayenterprise_inventory/details_item')->disableOriginalConstructor()->setMethods(null)->getMock();
     EcomDev_Utils_Reflection::setRestrictedPropertyValues($detail, ['isAvailable' => true, 'deliveryWindowFromDate' => new DateTime(), 'deliveryWindowToDate' => null, 'shippingWindowFromDate' => null, 'shippingWindowToDate' => null]);
     $config = $this->buildCoreConfigRegistry(['estimatedDeliveryTemplate' => 'eddtemplate']);
     $this->helperStub = $this->getHelperMockBuilder('ebayenterprise_inventory/data')->disableOriginalConstructor()->setMethods(['getConfigModel'])->getMock();
     $this->helperStub->expects($this->any())->method('getConfigModel')->will($this->returnValue($config));
     $this->item = Mage::getModel('sales/order_item');
     $this->detailService = $this->getModelMockBuilder('ebayenterprise_inventory/details_service')->disableOriginalConstructor()->setMethods(['getDetailsForOrderItem'])->getMock();
     $this->detailService->expects($this->once())->method('getDetailsForOrderItem')->will($this->returnValue($detail));
     $this->order = Mage::getModel('sales/order');
 }
 /**
  * setUp method
  */
 public function setUp()
 {
     parent::setUp();
     $this->logger = $this->getHelperMockBuilder('ebayenterprise_magelog/data')->disableOriginalConstructor()->getMock();
     $this->logContext = $this->getHelperMockBuilder('ebayenterprise_magelog/context')->disableOriginalConstructor()->getMock();
     $this->logContext->expects($this->any())->method('getMetaData')->will($this->returnValue([]));
     $this->request = $this->getMockForAbstractClass(self::INVENTORY_DETAIL_REQUEST_INTERFACE);
     $this->reply = $this->getMockForAbstractClass(self::INVENTORY_DETAIL_REPLY_INTERFACE);
     $this->httpApi = $this->getMockBuilder(self::HTTP_API)->disableOriginalConstructor()->setMethods(['send', 'getRequestBody', 'getResponseBody', 'setRequestBody'])->getMock();
     $this->httpApi->expects($this->any())->method('setRequestBody')->with($this->isInstanceOf(self::INVENTORY_DETAIL_REQUEST_INTERFACE))->will($this->returnSelf());
     $this->httpApi->expects($this->any())->method('getRequestBody')->will($this->returnValue($this->request));
     $this->httpApi->expects($this->any())->method('getResponseBody')->will($this->returnValue($this->reply));
     $this->quote = Mage::getModel('sales/quote');
 }
 public function setUp()
 {
     parent::setUp();
     $this->_api = $this->getMockBuilder(static::API_CLASS)->disableOriginalConstructor()->getMock();
     /** @var string */
     $this->_apiService = 'orders';
     /** @var string */
     $this->_apiOperation = 'cancel';
     /** @var EbayEnterprise_Eb2cCore_Model_Config_Registry */
     $this->_orderCfg = $this->buildCoreConfigRegistry(['apiService' => $this->_apiService, 'apiCancelOperation' => $this->_apiOperation]);
     /** EbayEnterprise_Eb2cCore_Helper_Data */
     $this->_coreHelper = $this->getHelperMock('eb2ccore/data', ['getSdkApi']);
     $this->_coreHelper->expects($this->any())->method('getSdkApi')->with($this->identicalTo($this->_apiService), $this->identicalTo($this->_apiOperation))->will($this->returnValue($this->_api));
 }
    public function setUp()
    {
        parent::setUp();
        $doc = new DOMDocument();
        $doc->loadXML(sprintf('<_>
			<Event>
				<Price>%.2f</Price>
				<AlternatePrice1>%.2f</AlternatePrice1>
				<StartDate>%s</StartDate>
				<EndDate>%s</EndDate>
			</Event>
		</_>', $this->specialPrice, $this->price, $this->start, $this->end));
        $this->eventNodeList = $doc->documentElement->getElementsByTagName('Event');
    }
 public function setUp()
 {
     parent::setUp();
     // replace the session for the logger context
     $this->_replaceSession('core/session');
     $this->itemStub = $this->getModelMock('sales/order_item', ['getId', 'getOrder']);
     $this->orderStub = $this->getModelMock('sales/order', ['load', 'save']);
     $this->addressStub = $this->getModelMock('sales/order_address', ['getId']);
     $this->addressStub->setData(['shipping_method' => 'someshipping method']);
     $this->shippingHelper = $this->getHelperMock('eb2ccore/shipping');
     $this->itemStub->expects($this->any())->method('getOrder')->will($this->returnValue($this->orderStub));
     $this->payload = Mage::helper('eb2ccore')->getSdkApi('orders', 'create')->getRequestBody()->getOrderItems()->getEmptyOrderItem();
     $this->itemStub->addData(['name' => 'itemstub', 'sku' => 'thesku', 'store_id' => 1, 'product_options' => serialize(['info_buyRequest' => ['super_attribute' => [92 => '15', 3 => '2']]])]);
     $this->optionValueCollectionStub = $this->getResourceModelMock('eav/entity_attribute_option_collection', ['load']);
 }
 public function setUp()
 {
     parent::setUp();
     // suppressing the real session from starting
     $session = $this->getModelMockBuilder('core/session')->disableOriginalConstructor()->setMethods(null)->getMock();
     $this->replaceByMock('singleton', 'core/session', $session);
     // disable _construct to prevent excessive stubs
     $this->coreUrl = $this->getModelMock('core/url', ['_construct', 'getUrl']);
     $this->coreUrl->expects($this->any())->method('getUrl')->will($this->returnValueMap([['ebayenterprise_paypal_express/checkout/return', [], 'the.return.url'], ['ebayenterprise_paypal_express/checkout/cancel', [], 'the.cancel.url']]));
     // stub sdk
     $this->sdk = $this->getMock(self::BIDIRECTIONAL_API);
     $this->sdk->expects($this->any())->method('setRequestBody')->will($this->returnSelf());
     $this->sdk->expects($this->any())->method('send')->will($this->returnSelf());
     $this->getSdkApiMap = [['payments', 'paypal/setExpress', [], null, $this->sdk], ['payments', 'paypal/getExpress', [], null, $this->sdk], ['payments', 'paypal/doExpress', [], null, $this->sdk], ['payments', 'paypal/doAuth', [], null, $this->sdk], ['payments', 'paypal/void', [], null, $this->sdk]];
     $this->lineItemStub = $this->getMock(self::LINE_ITEM);
     $this->stubAcceptStrReturnSelf(['setName', 'setCurrencyCode'], $this->lineItemStub);
     $this->lineItemStub->expects($this->any())->method('setUnitAmount')->with($this->isNumeric())->will($this->returnSelf());
     // sequence number can be set to any scalar
     $this->lineItemStub->expects($this->any())->method('setSequenceNumber')->with($this->isScalar())->will($this->returnSelf());
     $this->lineItemStub->expects($this->any())->method('setQuantity')->with($this->isType('int'))->will($this->returnSelf());
     $validatorIterator = new ValidatorIterator([$this->getMock('\\eBayEnterprise\\RetailOrderManagement\\Payload\\IValidator')]);
     $stubSchemaValidator = $this->getMock('\\eBayEnterprise\\RetailOrderManagement\\Payload\\ISchemaValidator');
     $payloadMap = new PayloadMap();
     $logger = new NullLogger();
     $this->lineItemIterableStub = $this->getMockBuilder(self::LINE_ITEM_ITERABLE)->setConstructorArgs([$validatorIterator, $stubSchemaValidator, $payloadMap, $logger])->setMethods(['getEmptyLineItem'])->getMock();
     $this->lineItemIterableStub->expects($this->any())->method('getEmptyLineItem')->will($this->returnValue($this->lineItemStub));
     // stub helpers
     $this->coreHelper = $this->getHelperMock('eb2ccore/data', ['getSdkApi']);
     $this->coreHelper->expects($this->any())->method('getSdkApi')->will($this->returnValueMap($this->getSdkApiMap));
     $this->helper = $this->getHelperMock('ebayenterprise_paypal/data', ['getConfigModel', '__']);
     $this->helper->expects($this->any())->method('__')->will($this->returnArgument(0));
     // stub a quote
     $strMethods = ['getCity', 'getRegionCode', 'getCountryId', 'getPostCode'];
     $this->quoteShipAddress = $this->getModelMock('sales/quote_address', $strMethods + ['getStreet', 'getId']);
     foreach ($strMethods as $setter) {
         $this->quoteShipAddress->expects($this->any())->method($setter)->will($this->returnValue('a string value'));
     }
     $this->quoteShipAddress->expects($this->any())->method('getStreet')->will($this->returnValue(['line 1', 'line 2']));
     $this->quoteShipAddress->expects($this->any())->method('getId')->will($this->returnValue(1));
     $this->quote = $this->getModelMock('sales/quote', ['reserveOrderId', 'getReservedOrderId', 'getAllItems', 'getTotals', 'getShippingAddress']);
     $this->quote->expects($this->any())->method('reserveOrderId')->will($this->returnSelf());
     $this->quote->expects($this->any())->method('getTotals')->will($this->returnValue(['grand_total' => new Varien_Object(['value' => 100]), 'shipping' => new Varien_Object(['value' => 5.95]), 'ebayenterprise_tax' => new Varien_Object(['value' => 2.5]), 'discount' => new Varien_Object(['value' => 100])]));
     $this->quote->expects($this->any())->method('getReservedOrderId')->will($this->returnValue('orderid'));
     $this->quote->expects($this->any())->method('getAllItems')->will($this->returnValue($this->stubQuoteItems()));
     $this->quote->expects($this->any())->method('getShippingAddress')->will($this->returnValue($this->quoteShipAddress));
     $this->quote->setData(['quote_currency_code' => 'USD']);
 }
 public function setUp()
 {
     parent::setUp();
     $this->api = $this->getMockBuilder('\\eBayEnterprise\\RetailOrderManagement\\Api\\IBidirectionalApi')->getMockForAbstractClass();
     $this->request = $this->getMockBuilder('\\eBayEnterprise\\RetailOrderManagement\\Payload\\Payment\\TenderType\\ILookupRequest')->getMockForAbstractClass();
     $this->reply = $this->getMockBuilder('\\eBayEnterprise\\RetailOrderManagement\\Payload\\Payment\\TenderType\\ILookupReply')->getMockForAbstractClass();
     // mock the api to work wiht the request and reply
     // payload mocks
     $this->api->expects($this->once())->method('getRequestBody')->will($this->returnValue($this->request));
     $this->api->expects($this->any())->method('setRequestBody')->with($this->identicalTo($this->request))->will($this->returnSelf());
     $this->api->expects($this->any())->method('getResponseBody')->will($this->returnValue($this->reply));
     $this->request->expects($this->once())->method('setCardNumber')->with($this->identicalTo($this->cardNumber))->will($this->returnSelf());
     $this->request->expects($this->once())->method('setCurrencyCode')->with($this->identicalTo($this->currencyCode))->will($this->returnSelf());
     $this->request->expects($this->once())->method('setPanIsToken')->with($this->identicalTo($this->panIsToken))->will($this->returnSelf());
     $this->request->expects($this->once())->method('setTenderClass')->with($this->identicalTo(ILookupRequest::CLASS_STOREDVALUE))->will($this->returnSelf());
     $this->logger = $this->getHelperMockBuilder('ebayenterprise_magelog/data')->disableOriginalConstructor()->getMock();
     $this->logContext = $this->getHelperMockBuilder('ebayenterprise_magelog/context')->disableOriginalConstructor()->getMock();
     $this->logContext->expects($this->any())->method('getMetaData')->will($this->returnValue([]));
     $this->constructorArgs = ['api' => $this->api, 'card_number' => $this->cardNumber, 'pan_is_token' => $this->panIsToken, 'currency_code' => $this->currencyCode, 'logger' => $this->logger, 'log_context' => $this->logContext];
 }
 public function setUp()
 {
     parent::setUp();
     $this->_mockCustomerSession();
     $this->_mockCheckoutSession();
     $this->_sdkApi = $this->_mockSdkApi();
     $this->_coreHelper = $this->getHelperMock('eb2ccore/data', ['getSdkApi']);
     $this->_coreHelper->expects($this->any())->method('getSdkApi')->will($this->returnValue($this->_sdkApi));
     // Stub the __get method with config key => value value map in tests that need to mock config
     $this->_addressConfig = $this->buildCoreConfigRegistry();
     $this->_addressHelper = $this->getHelperMock('ebayenterprise_address/data', ['__', 'getConfigModel']);
     $this->_addressHelper->expects($this->any())->method('__')->will($this->returnArgument(0));
     $this->_addressHelper->expects($this->any())->method('getConfigModel')->will($this->returnValue($this->_addressConfig));
     $this->_validatorRequest = $this->getModelMockBuilder('ebayenterprise_address/validation_request')->disableOriginalConstructor()->setMethods(['prepareRequest', 'getRequest'])->getMock();
     $this->_validatorResponse = $this->getModelMockBuilder('ebayenterprise_address/validation_response')->disableOriginalConstructor()->setMethods(['getValidAddress', 'getOriginalAddress', 'getHasSuggestions', 'getAddressSuggestions', 'isAddressValid'])->getMock();
     $this->_validator = $this->getModelMockBuilder('ebayenterprise_address/validator')->setMethods(['_prepareApiForAddressRequest', '_getValidationResponse'])->setConstructorArgs([['core_helper' => $this->_coreHelper, 'helper' => $this->_addressHelper]])->getMock();
     $this->_validator->expects($this->any())->method('_getValidationResponse')->will($this->returnValue($this->_validatorResponse));
     // suppressing the real session from starting
     $session = $this->getModelMockBuilder('core/session')->disableOriginalConstructor()->setMethods(null)->getMock();
     $this->replaceByMock('singleton', 'core/session', $session);
 }
 public function tearDown()
 {
     parent::tearDown();
     // delete the previous helper
     Mage::unregister('_helper/ebayenterprise_order');
 }
 public function tearDown()
 {
     parent::tearDown();
     $this->_doc = null;
 }
 public function tearDown()
 {
     parent::tearDown();
     Mage::app()->enableEvents();
 }
 /**
  * Stub the core session
  */
 public function setUp()
 {
     parent::setUp();
     $this->_replaceSession('core/session');
 }