public function testWriteXml()
 {
     $xml = new \XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $this->setExpectedException('RuntimeException');
     $inv = new Inventory($xml);
     $inv->writeXml();
 }
 /**
  * Add inventory to feed
  * 
  * @param Inventory $inventory
  * 
  * @return InventoryFeed 
  */
 public function addInventory(Inventory $inventory)
 {
     $this->xml->startElement('Message');
     $this->xml->writeElement('MessageID', $this->messageCount);
     $this->xml->writeElement('OperationType', 'Update');
     $inventory->writeXml();
     $this->xml->endElement();
     $this->messageCount++;
     return $this;
 }
 /**
  * @depends testInventoryFeed
  */
 public function testAddInventory()
 {
     $client = $this->getServiceBuilder()->get('test.mws');
     $feed = $client->getFeed('inventory');
     $inventory = new Inventory($feed->getXml());
     $inventory->setSku('ASDF')->setQuantity(1);
     $feed->addInventory($inventory);
     $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 Inventory', 1, $dom, null, false);
 }