コード例 #1
0
 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;
 }