/** * @depends testFetchPlan */ public function testGetShipmentId($o) { $this->assertEquals('FBA63J76R', $o->getShipmentId(0)); $this->assertEquals('FBA63HGKJ', $o->getShipmentId(1)); $this->assertFalse($o->getShipmentId('wrong')); //not number $this->assertFalse($o->getShipmentId(1.5)); //not integer $this->assertFalse($this->object->getShipmentId()); //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; }