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;
 }
 public function testUsePlan()
 {
     $planner = new AmazonShipmentPlanner('testStore', true, 'fetchPlan.xml', __DIR__ . '/../../test-config.php');
     $a = array();
     $a['Name'] = 'Name';
     $a['AddressLine1'] = 'AddressLine1';
     $a['City'] = 'City';
     $a['StateOrProvinceCode'] = 'StateOrProvinceCode';
     $a['CountryCode'] = 'CountryCode';
     $a['PostalCode'] = 'PostalCode';
     $planner->setAddress($a);
     $i = array();
     $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;
 }