public function testSubmitFeed()
 {
     resetLog();
     $this->object->setMock(true, 'submitFeed.xml');
     $this->assertFalse($this->object->submitFeed());
     //nothing set yet
     $this->assertFalse($this->object->getResponse());
     //no response yet either
     $this->object->setFeedContent('yes');
     $this->assertFalse($this->object->submitFeed());
     //no feed type set yet
     $this->object->setFeedType('_MOCK_FEED_');
     $ok = $this->object->submitFeed();
     //now it is good
     $this->assertNull($ok);
     $check = parseLog();
     $this->assertEquals('Single Mock File set: submitFeed.xml', $check[1]);
     $this->assertEquals('Feed\'s contents must be set in order to submit it!', $check[2]);
     $this->assertEquals('Feed Type must be set in order to submit a feed!', $check[3]);
     $this->assertEquals('Fetched Mock File: mock/submitFeed.xml', $check[4]);
     $this->assertEquals('Successfully submitted feed #1234567890 (_MOCK_FEED_)', $check[5]);
     $o = $this->object->getOptions();
     $this->assertEquals('SubmitFeed', $o['Action']);
     $r = $this->object->getResponse();
     $this->assertInternalType('array', $r);
     $this->assertArrayHasKey('FeedSubmissionId', $r);
     $this->assertEquals('1234567890', $r['FeedSubmissionId']);
     $this->assertArrayHasKey('FeedType', $r);
     $this->assertEquals('_MOCK_FEED_', $r['FeedType']);
     $this->assertArrayHasKey('SubmittedDate', $r);
     $this->assertEquals('2012-12-12T12:12:12+00:00', $r['SubmittedDate']);
     $this->assertArrayHasKey('FeedProcessingStatus', $r);
     $this->assertEquals('_SUBMITTED_', $r['FeedProcessingStatus']);
 }
 /**
  * @depends testFetchFeedResult
  */
 public function testSaveFeed($o)
 {
     resetLog();
     $this->assertFalse($this->object->saveFeed('mock/saveFeed.xml'));
     //nothing yet
     $o->saveFeed(__DIR__ . '/../../mock/saveFeed.xml');
     $check = parseLog();
     $this->assertEquals('Successfully saved feed #77 at ' . __DIR__ . '/../../mock/saveFeed.xml', $check[0]);
 }
 /**
  * @covers AmazonCore::setStore
  * @todo   Implement testSetStore().
  */
 public function testSetStore()
 {
     $this->object->setStore('no');
     $check = parseLog();
     $this->assertEquals('Mock Mode set to ON', $check[0]);
     $this->assertEquals('Store no does not exist!', $check[1]);
     resetLog();
     $this->object->setStore('bad');
     $bad = parseLog();
     $this->assertEquals('Merchant ID is missing!', $bad[0]);
     $this->assertEquals('Access Key ID is missing!', $bad[1]);
     $this->assertEquals('Secret Key is missing!', $bad[2]);
 }
 public function testAcknowledgeReports()
 {
     resetLog();
     $this->object->setMock(true, 'acknowledgeReports.xml');
     $this->assertFalse($this->object->acknowledgeReports());
     //no Report ID set yet
     $this->object->setReportIds('123456');
     $this->assertNull($this->object->acknowledgeReports());
     $check = parseLog();
     $this->assertEquals('Single Mock File set: acknowledgeReports.xml', $check[1]);
     $this->assertEquals('Report IDs must be set in order to acknowledge reports!', $check[2]);
     $this->assertEquals('Fetched Mock File: mock/acknowledgeReports.xml', $check[3]);
     return $this->object;
 }
 public function testSearchProducts()
 {
     resetLog();
     $this->object->setMock(true, 'searchProducts.xml');
     $this->assertFalse($this->object->searchProducts());
     //no query yet
     $this->object->setQuery('platinum');
     $this->assertNull($this->object->searchProducts());
     $o = $this->object->getOptions();
     $this->assertEquals('ListMatchingProducts', $o['Action']);
     $check = parseLog();
     $this->assertEquals('Single Mock File set: searchProducts.xml', $check[1]);
     $this->assertEquals('Search Query must be set in order to search for a query!', $check[2]);
     $this->assertEquals('Fetched Mock File: mock/searchProducts.xml', $check[3]);
     return $this->object;
 }
 public function testFetchServiceStatus()
 {
     resetLog();
     $this->object->setMock(true, 'fetchServiceStatus.xml');
     $this->assertFalse($this->object->fetchServiceStatus());
     //no service set yet
     $this->object->setService('Inbound');
     $this->assertNull($this->object->fetchServiceStatus());
     //now it is good
     $o = $this->object->getOptions();
     $this->assertEquals('GetServiceStatus', $o['Action']);
     $check = parseLog();
     $this->assertEquals('Single Mock File set: fetchServiceStatus.xml', $check[1]);
     $this->assertEquals('Service must be set in order to retrieve status', $check[2]);
     $this->assertEquals('Fetched Mock File: mock/fetchServiceStatus.xml', $check[3]);
     return $this->object;
 }
 public function testFetchTrackingDetails()
 {
     resetLog();
     $this->object->setMock(true, 'fetchTrackingDetails.xml');
     $this->assertFalse($this->object->fetchTrackingDetails());
     //no package ID set yet
     $this->object->setPackageNumber('777');
     $ok = $this->object->fetchTrackingDetails();
     //now it is good
     $this->assertNull($ok);
     $o = $this->object->getOptions();
     $this->assertEquals('GetPackageTrackingDetails', $o['Action']);
     $check = parseLog();
     $this->assertEquals('Single Mock File set: fetchTrackingDetails.xml', $check[1]);
     $this->assertEquals('Package Number must be set in order to fetch it!', $check[2]);
     $this->assertEquals('Fetched Mock File: mock/fetchTrackingDetails.xml', $check[3]);
     return $this->object;
 }
 public function testFetchReport()
 {
     resetLog();
     $this->object->setMock(true, 'fetchReport.xml');
     $this->assertFalse($this->object->fetchReport());
     //no report ID set yet
     $this->object->setReportId('777');
     $ok = $this->object->fetchReport();
     //now it is good
     $this->assertNull($ok);
     $o = $this->object->getOptions();
     $this->assertEquals('GetReport', $o['Action']);
     $check = parseLog();
     $this->assertEquals('Single Mock File set: fetchReport.xml', $check[1]);
     $this->assertEquals('Report ID must be set in order to fetch it!', $check[2]);
     $this->assertEquals('Fetched Mock File: mock/fetchReport.xml', $check[3]);
     return $this->object;
 }
 public function testFetchOrder()
 {
     resetLog();
     $this->object->setMock(true, 'fetchOrder.xml');
     $this->assertFalse($this->object->fetchOrder());
     //no order ID set yet
     $this->object->setOrderId('058-1233752-8214740');
     $this->assertNull($this->object->fetchOrder());
     //now it is good
     $o = $this->object->getOptions();
     $this->assertEquals('GetOrder', $o['Action']);
     $check = parseLog();
     $this->assertEquals('Single Mock File set: fetchOrder.xml', $check[1]);
     $this->assertEquals('Order ID must be set in order to fetch it!', $check[2]);
     $this->assertEquals('Fetched Mock File: mock/fetchOrder.xml', $check[3]);
     $get = $this->object->getData();
     $this->assertInternalType('array', $get);
     return $this->object;
 }
 public function testManageReportSchedule()
 {
     resetLog();
     $this->object->setMock(true, 'manageReportSchedule.xml');
     $this->assertFalse($this->object->manageReportSchedule());
     //no report type yet
     $this->object->setReportType('_GET_ORDERS_DATA_');
     $this->assertFalse($this->object->manageReportSchedule());
     //no report schedule yet
     $this->object->setSchedule('_30_DAYS_');
     $this->assertNull($this->object->manageReportSchedule());
     $o = $this->object->getOptions();
     $this->assertEquals('ManageReportSchedule', $o['Action']);
     $check = parseLog();
     $this->assertEquals('Single Mock File set: manageReportSchedule.xml', $check[1]);
     $this->assertEquals('Report Type must be set in order to manage a report schedule!', $check[2]);
     $this->assertEquals('Schedule must be set in order to manage a report schedule!', $check[3]);
     $this->assertEquals('Fetched Mock File: mock/manageReportSchedule.xml', $check[4]);
     return $this->object;
 }
 public function testFetchProductList()
 {
     resetLog();
     $this->object->setMock(true, 'fetchProductList.xml');
     $this->assertFalse($this->object->fetchProductList());
     //no IDs yet
     $this->object->setProductIds('789');
     $this->assertFalse($this->object->fetchProductList());
     //no ID type yet
     $this->object->setIdType('ASIN');
     $this->assertNull($this->object->fetchProductList());
     $o = $this->object->getOptions();
     $this->assertEquals('GetMatchingProductForId', $o['Action']);
     $check = parseLog();
     $this->assertEquals('Single Mock File set: fetchProductList.xml', $check[1]);
     $this->assertEquals('Product IDs must be set in order to fetch them!', $check[2]);
     $this->assertEquals('ID Type must be set in order to use the given IDs!', $check[3]);
     $this->assertEquals('Fetched Mock File: mock/fetchProductList.xml', $check[4]);
     return $this->object;
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     resetLog();
     $this->object = new AmazonParticipationList('testStore', true, null, __DIR__ . '/../test-config.php');
 }
 public function testCancelFeeds()
 {
     resetLog();
     $this->object->setMock(true, 'cancelFeeds.xml');
     $this->assertFalse($this->object->getFeedCount());
     //not fetched yet
     $ok = $this->object->cancelFeeds();
     $this->assertNull($ok);
     $check = parseLog();
     $this->assertEquals('Single Mock File set: cancelFeeds.xml', $check[1]);
     $this->assertEquals('Fetched Mock File: mock/cancelFeeds.xml', $check[2]);
     $this->assertEquals('Successfully cancelled 1 report requests.', $check[3]);
     $o = $this->object->getOptions();
     $this->assertEquals('CancelFeedSubmissions', $o['Action']);
     $count = $this->object->getFeedCount();
     $this->assertEquals('1', $count);
 }
Пример #14
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     resetLog();
     $this->object = new AmazonOrder('testStore', null, null, true, null, __DIR__ . '/../test-config.php');
 }
 public function testRequestReport()
 {
     resetLog();
     $this->object->setMock(true, 'requestReport.xml');
     $this->assertFalse($this->object->requestReport());
     $this->object->setReportType('Type');
     $this->assertNull($this->object->requestReport());
     $o = $this->object->getOptions();
     $this->assertEquals('RequestReport', $o['Action']);
     $check = parseLog();
     $this->assertEquals('Single Mock File set: requestReport.xml', $check[1]);
     $this->assertEquals('Report Type must be set in order to request a report!', $check[2]);
     $this->assertEquals('Fetched Mock File: mock/requestReport.xml', $check[3]);
     return $this->object;
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     setupDummyConfigFile();
     resetLog();
     $this->object = new AmazonReport('testStore', null, true, null, __DIR__ . '/../test-config.php');
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     resetLog();
     $this->object = new AmazonServiceStatus('testStore', null, true, null, __DIR__ . '/test-config.php');
 }
 public function testFetchCategories()
 {
     resetLog();
     $this->object->setMock(true, 'fetchCategories.xml');
     $this->assertFalse($this->object->fetchCategories());
     //no IDs yet
     $this->object->setSKUs('789');
     $this->assertNull($this->object->fetchCategories());
     $o = $this->object->getOptions();
     $this->assertEquals('GetProductCategoriesForSKU', $o['Action']);
     $check = parseLog();
     $this->assertEquals('Single Mock File set: fetchCategories.xml', $check[1]);
     $this->assertEquals('Product IDs must be set in order to look them up!', $check[2]);
     $this->assertEquals('Fetched Mock File: mock/fetchCategories.xml', $check[3]);
     return $this->object;
 }
 public function testFetchCount()
 {
     resetLog();
     $this->object->setReportTypes('123456');
     $this->object->setMock(true, 'fetchReportScheduleCount.xml');
     $this->assertNull($this->object->fetchCount());
     $o = $this->object->getOptions();
     $this->assertEquals('GetReportScheduleCount', $o['Action']);
     $check = parseLog();
     $this->assertEquals('Single Mock File set: fetchReportScheduleCount.xml', $check[1]);
     $this->assertEquals('Fetched Mock File: mock/fetchReportScheduleCount.xml', $check[2]);
     $this->assertFalse($this->object->hasToken());
     return $this->object;
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     setupDummyConfigFile();
     resetLog();
     $this->object = new AmazonFulfillmentOrderCreator('testStore', true, null, __DIR__ . '/../test-config.php');
 }
 public function testFetchShipmentsToken2()
 {
     resetLog();
     $this->object->setMock(true, array('fetchShipmentItemsToken.xml', 'fetchShipmentItemsToken2.xml'));
     //with using token
     $this->object->setUseToken();
     $this->object->setShipmentId('123');
     $this->assertNull($this->object->fetchItems());
     $check = parseLog();
     $this->assertEquals('Mock files array set.', $check[1]);
     $this->assertEquals('Fetched Mock File: mock/fetchShipmentItemsToken.xml', $check[2]);
     $this->assertEquals('Recursively fetching more shipment items', $check[3]);
     $this->assertEquals('Fetched Mock File: mock/fetchShipmentItemsToken2.xml', $check[4]);
     $this->assertFalse($this->object->hasToken());
     $o = $this->object->getOptions();
     $this->assertEquals('ListInboundShipmentItemsByNextToken', $o['Action']);
     $r = $this->object->getItems();
     $this->assertArrayHasKey(0, $r);
     $this->assertArrayHasKey(1, $r);
     $this->assertEquals(2, count($r));
     $this->assertInternalType('array', $r[0]);
     $this->assertInternalType('array', $r[1]);
     $this->assertNotEquals($r[0], $r[1]);
 }
 public function testFetchPreview()
 {
     resetLog();
     $this->object->setMock(true, 'fetchPreview.xml');
     $this->assertFalse($this->object->fetchPreview());
     //no address set yet
     $a = array();
     $a['Name'] = 'Name';
     $a['Line1'] = 'Line1';
     $a['City'] = 'City';
     $a['StateOrProvidenceCode'] = 'StateOrProvidenceCode';
     $a['CountryCode'] = 'CountryCode';
     $a['PostalCode'] = 'PostalCode';
     $this->object->setAddress($a);
     $this->assertFalse($this->object->fetchPreview());
     //no items set yet
     $i = array();
     $i[0]['SellerSKU'] = 'SellerSKU';
     $i[0]['SellerFulfillmentOrderItemId'] = 'SellerFulfillmentOrderItemId';
     $i[0]['Quantity'] = 'Quantity';
     $this->object->setItems($i);
     $this->assertNull($this->object->fetchPreview());
     $check = parseLog();
     $this->assertEquals('Single Mock File set: fetchPreview.xml', $check[1]);
     $this->assertEquals('Address must be set in order to create a preview', $check[2]);
     $this->assertEquals('Items must be set in order to create a preview', $check[3]);
     $this->assertEquals('Fetched Mock File: mock/fetchPreview.xml', $check[4]);
     return $this->object;
 }
 public function testFetchCount()
 {
     resetLog();
     $this->object->setRequestIds('123456');
     $this->object->setMaxCount(77);
     $this->object->setMock(true, 'fetchReportCount.xml');
     $this->assertNull($this->object->fetchCount());
     $o = $this->object->getOptions();
     $this->assertEquals('GetReportCount', $o['Action']);
     $this->assertArrayNotHasKey('ReportRequestIdList.Id.1', $o);
     $this->assertArrayNotHasKey('MaxCount', $o);
     $check = parseLog();
     $this->assertEquals('Single Mock File set: fetchReportCount.xml', $check[1]);
     $this->assertEquals('Fetched Mock File: mock/fetchReportCount.xml', $check[2]);
     $this->assertFalse($this->object->hasToken());
     return $this->object;
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     setupDummyConfigFile();
     resetLog();
     $this->object = new AmazonServiceStatus('testStore', 'Inbound', true, null, __DIR__ . '/../test-config.php');
 }
 public function testFetchOrderListToken2()
 {
     resetLog();
     $this->object->setMock(true, array('fetchFulfillmentOrderListToken.xml', 'fetchFulfillmentOrderListToken2.xml'));
     //with using token
     $this->object->setUseToken();
     $this->assertNull($this->object->fetchOrderList());
     $check = parseLog();
     $this->assertEquals('Mock files array set.', $check[1]);
     $this->assertEquals('Fetched Mock File: mock/fetchFulfillmentOrderListToken.xml', $check[2]);
     $this->assertEquals('Recursively fetching more Orders', $check[3]);
     $this->assertEquals('Fetched Mock File: mock/fetchFulfillmentOrderListToken2.xml', $check[4]);
     $this->assertFalse($this->object->hasToken());
     $o = $this->object->getOptions();
     $this->assertEquals('ListAllFulfillmentOrdersByNextToken', $o['Action']);
     $r = $this->object->getOrder(null);
     $this->assertArrayHasKey(0, $r);
     $this->assertArrayHasKey(1, $r);
     $this->assertEquals('extern_id_1154539615776', $r[0]['SellerFulfillmentOrderId']);
     $this->assertEquals('external-order-ebaytime1154557376014', $r[1]['SellerFulfillmentOrderId']);
     $this->assertNotEquals($r[0], $r[1]);
 }
 /**
  * @depends testUsePlan
  */
 public function testUpdateShipment($o)
 {
     resetLog();
     $this->object = new AmazonShipment('testStore', true, null, __DIR__ . '/../test-config.php');
     $this->assertFalse($this->object->updateShipment());
     //no ID set
     $this->object->setShipmentId('55');
     $this->assertFalse($this->object->updateShipment());
     //no header set
     $a = [];
     $a['Name'] = 'Name';
     $a['AddressLine1'] = 'AddressLine1';
     $a['City'] = 'City';
     $a['StateOrProvinceCode'] = 'StateOrProvinceCode';
     $a['CountryCode'] = 'CountryCode';
     $a['PostalCode'] = 'PostalCode';
     $this->object->setAddress($a);
     $this->assertFalse($this->object->updateShipment());
     //no items yet
     $o->setMock(true, 'updateShipment.xml');
     $this->assertTrue($o->updateShipment());
     //this one is good
     $op = $o->getOptions();
     $this->assertEquals('UpdateInboundShipment', $op['Action']);
     $check = parseLog();
     $this->assertEquals('Shipment ID must be set in order to update it', $check[1]);
     $this->assertEquals('Header must be set in order to update a shipment', $check[2]);
     $this->assertEquals('Items must be set in order to update a shipment', $check[3]);
     $this->assertEquals('Single Mock File set: updateShipment.xml', $check[5]);
     $this->assertEquals('Fetched Mock File: test/mock/updateShipment.xml', $check[6]);
     $this->assertEquals('Successfully updated Shipment #FBA63J76R', $check[7]);
 }
 public function testFetchPlan()
 {
     resetLog();
     $this->object->setMock(true, 'fetchPlan.xml');
     $this->assertFalse($this->object->fetchPlan());
     //no address set yet
     $a = array();
     $a['Name'] = 'Name';
     $a['AddressLine1'] = 'AddressLine1';
     $a['City'] = 'City';
     $a['StateOrProvinceCode'] = 'StateOrProvinceCode';
     $a['CountryCode'] = 'CountryCode';
     $a['PostalCode'] = 'PostalCode';
     $this->object->setAddress($a);
     $this->assertFalse($this->object->fetchPlan());
     //no items set yet
     $i = array();
     $i[0]['SellerSKU'] = 'NewSellerSKU';
     $i[0]['Quantity'] = 'NewQuantity';
     $this->object->setItems($i);
     $this->assertNull($this->object->fetchPlan());
     //now it is good
     $o = $this->object->getOptions();
     $this->assertEquals('CreateInboundShipmentPlan', $o['Action']);
     $check = parseLog();
     $this->assertEquals('Single Mock File set: fetchPlan.xml', $check[1]);
     $this->assertEquals('Address must be set in order to make a plan', $check[2]);
     $this->assertEquals('Items must be set in order to make a plan', $check[3]);
     $this->assertEquals('Fetched Mock File: mock/fetchPlan.xml', $check[4]);
     return $this->object;
 }
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     resetLog();
     $this->object = new AmazonReportScheduleList('testStore', true, null, __DIR__ . '/../test-config.php');
 }
 public function testCreateOrder()
 {
     resetLog();
     $this->object->setMock(true, array(503, 200));
     $this->assertFalse($this->object->createOrder());
     //no Seller Fulfillment Order ID set yet
     $this->object->setFulfillmentOrderId('123ABC');
     $this->assertFalse($this->object->createOrder());
     //no Displayable Order ID set yet
     $this->object->setDisplayableOrderId('ABC123');
     $this->assertFalse($this->object->createOrder());
     //no Date set yet
     $this->object->setDate('-1 min');
     $this->assertFalse($this->object->createOrder());
     //no Displayable Order Comment set yet
     $this->object->setComment('A comment.');
     $this->assertFalse($this->object->createOrder());
     //no Shipping Speed Category set yet
     $this->object->setShippingSpeed('Standard');
     $this->assertFalse($this->object->createOrder());
     //no Destination Address set yet
     $a = array();
     $a['Name'] = 'Name';
     $a['Line1'] = 'Line1';
     $a['City'] = 'City';
     $a['StateOrProvidenceCode'] = 'StateOrProvidenceCode';
     $a['CountryCode'] = 'CountryCode';
     $a['PostalCode'] = 'PostalCode';
     $this->object->setAddress($a);
     $this->assertFalse($this->object->createOrder());
     //no Items set yet
     $i = array();
     $i[0]['SellerSKU'] = 'NewSellerSKU';
     $i[0]['SellerFulfillmentOrderItemId'] = 'NewSellerFulfillmentOrderItemId';
     $i[0]['Quantity'] = 'NewQuantity';
     $this->object->setItems($i);
     $this->object->createOrder();
     //attempt 1: oops, bad response
     $this->object->createOrder();
     //attempt 2: success
     $check = parseLog();
     $this->assertEquals('Mock files array set.', $check[1]);
     $this->assertEquals('Seller Fulfillment OrderID must be set in order to create an order', $check[2]);
     $this->assertEquals('Displayable Order ID must be set in order to create an order', $check[3]);
     $this->assertEquals('Date must be set in order to create an order', $check[4]);
     $this->assertEquals('Comment must be set in order to create an order', $check[5]);
     $this->assertEquals('Shipping Speed must be set in order to create an order', $check[6]);
     $this->assertEquals('Address must be set in order to create an order', $check[7]);
     $this->assertEquals('Items must be set in order to create an order', $check[8]);
     $this->assertEquals('Returning Mock Response: 503', $check[9]);
     $this->assertEquals('Bad Response! 503 Service Unavailable: Service Unavailable - Service Unavailable', $check[10]);
     $this->assertEquals('Returning Mock Response: 200', $check[11]);
     $this->assertEquals('Successfully created Fulfillment Order 123ABC / ABC123', $check[12]);
 }
 public function testFetchItems()
 {
     $this->object->setMock(true, array('fetchOrderList.xml', 'fetchOrderItems.xml'));
     $this->object->fetchOrders();
     resetLog();
     $get = $this->object->fetchItems();
     $this->assertInternalType('array', $get);
     $this->assertEquals(3, count($get));
     $this->assertInternalType('object', $get[0]);
     $this->assertInternalType('object', $get[1]);
     $this->assertInternalType('object', $get[2]);
     $getOne = $this->object->fetchItems('string', 0);
     //$token will be set to false
     $this->assertInternalType('object', $getOne);
     $o = new AmazonOrderList('testStore', true, null, __DIR__ . '/../../test-config.php');
     $this->assertFalse($o->fetchItems());
     //not fetched yet for this object
 }