/** * @depends testFetchPlan */ public function testGetPlan($o) { $x = []; $x1 = []; $a1 = []; $a1['PostalCode'] = '85043'; $a1['Name'] = 'Amazon.com'; $a1['CountryCode'] = 'US'; $a1['StateOrProvinceCode'] = 'AZ'; $a1['AddressLine1'] = '4750 West Mohave St'; $a1['City'] = 'Phoenix'; $x1['ShipToAddress'] = $a1; $x1['ShipmentId'] = 'FBA63J76R'; $x1['DestinationFulfillmentCenterId'] = 'PHX6'; $x1['LabelPrepType'] = 'NO_LABEL'; $i1 = []; $i1[0]['SellerSKU'] = 'Football2415'; $i1[0]['Quantity'] = '3'; $i1[0]['FulfillmentNetworkSKU'] = 'B000FADVPQ'; $i1[1]['SellerSKU'] = 'TeeballBall3251'; $i1[1]['Quantity'] = '5'; $i1[1]['FulfillmentNetworkSKU'] = 'B0011VECH4'; $x1['Items'] = $i1; $x[0] = $x1; $x2 = []; $a2 = $a1; $a2['AddressLine1'] = '6835 West Buckeye Road'; $x2['ShipToAddress'] = $a2; $x2['ShipmentId'] = 'FBA63HGKJ'; $x2['DestinationFulfillmentCenterId'] = 'PHX3'; $x2['LabelPrepType'] = 'SELLER_LABEL'; $i2 = []; $i2[0]['SellerSKU'] = 'DVD2468'; $i2[0]['Quantity'] = '2'; $i2[0]['FulfillmentNetworkSKU'] = 'X000579L45'; $x2['Items'] = $i2; $x[1] = $x2; $this->assertEquals($x, $o->getPlan()); $this->assertEquals($x1, $o->getPlan(0)); $this->assertEquals($x2, $o->getPlan(1)); $this->assertFalse($this->object->getPlan()); //not fetched yet for this object }
public function testUsePlan() { $planner = new AmazonShipmentPlanner('testStore', true, 'fetchPlan.xml', __DIR__ . '/../test-config.php'); $a = []; $a['Name'] = 'Name'; $a['AddressLine1'] = 'AddressLine1'; $a['City'] = 'City'; $a['StateOrProvinceCode'] = 'StateOrProvinceCode'; $a['CountryCode'] = 'CountryCode'; $a['PostalCode'] = 'PostalCode'; $planner->setAddress($a); $i = []; $i[0]['SellerSKU'] = 'NewSellerSKU'; $i[0]['Quantity'] = 'NewQuantity'; $planner->setItems($i); $this->assertNull($planner->fetchPlan()); $plan = $planner->getPlan(0); $this->assertNull($this->object->usePlan($plan)); $o = $this->object->getOptions(); $this->assertEquals('FBA63J76R', $o['InboundShipmentHeader.ShipmentId']); $this->assertEquals('PHX6', $o['InboundShipmentHeader.DestinationFulfillmentCenterId']); $this->assertEquals('NO_LABEL', $o['InboundShipmentHeader.LabelPrepType']); $this->assertEquals('Amazon.com', $o['InboundShipmentHeader.ShipFromAddress.Name']); $this->assertEquals('4750 West Mohave St', $o['InboundShipmentHeader.ShipFromAddress.AddressLine1']); $this->assertEquals(null, $o['InboundShipmentHeader.ShipFromAddress.AddressLine2']); $this->assertEquals('Phoenix', $o['InboundShipmentHeader.ShipFromAddress.City']); $this->assertEquals(null, $o['InboundShipmentHeader.ShipFromAddress.DistrictOrCounty']); $this->assertEquals('AZ', $o['InboundShipmentHeader.ShipFromAddress.StateOrProvinceCode']); $this->assertEquals('US', $o['InboundShipmentHeader.ShipFromAddress.CountryCode']); $this->assertEquals('85043', $o['InboundShipmentHeader.ShipFromAddress.PostalCode']); $this->assertEquals('Football2415', $o['InboundShipmentItems.member.1.SellerSKU']); $this->assertEquals('3', $o['InboundShipmentItems.member.1.QuantityShipped']); $this->assertEquals('TeeballBall3251', $o['InboundShipmentItems.member.2.SellerSKU']); $this->assertEquals('5', $o['InboundShipmentItems.member.2.QuantityShipped']); resetLog(); $this->assertFalse($this->object->usePlan(null)); $check = parseLog(); $this->assertEquals('usePlan requires an array', $check[0]); return $this->object; }