public function testSetCarrierCode() { $xml = new \XMLWriter(); $xml->openMemory(); $xml->setIndent(true); $f = new OrderFulfillment($xml); $this->setExpectedException('InvalidArgumentException'); $f->setCarrierCode('Foo'); }
/** * Add fulfillment to feed * * @param OrderFulfillment $orderFulfillment * * @return OrderFulfillment */ public function addFulfillment(OrderFulfillment $orderFulfillment) { $this->xml->startElement('Message'); $this->xml->writeElement('MessageID', $this->messageCount); $this->xml->writeElement('OperationType', 'Update'); $orderFulfillment->writeXml(); $this->xml->endElement(); $this->messageCount++; return $this; }
/** * @depends testOrderFulfillmentFeed */ public function testAddFulfillment() { $client = $this->getServiceBuilder()->get('test.mws'); $feed = $client->getFeed('order_fulfillment'); $fulfillment = new OrderFulfillment($feed->getXml()); $fulfillment->setAmazonOrderId('000-123-123')->setShipperTrackingNumber('ASDF'); $feed->addFulfillment($fulfillment); $dom = new \DOMDocument(); $dom->loadXML($feed->toString()); $this->assertSelectEquals('AmazonEnvelope Message MessageID', '1', true, $dom, null, false); $this->assertSelectEquals('AmazonEnvelope Message OperationType', 'Update', true, $dom, null, false); $this->assertSelectCount('AmazonEnvelope Message OrderFulfillment', 1, $dom, null, false); $this->assertSelectCount('AmazonEnvelope Message OrderFulfillment FulfillmentData', 1, $dom, null, false); }