public function testSetImageType() { $xml = new \XMLWriter(); $xml->openMemory(); $xml->setIndent(true); $image = new Image($xml); $this->setExpectedException('InvalidArgumentException'); $image->setImageType('Foo'); }
/** * Add image to feeed * * @param Image $image * * @return ImageFeed */ public function addImage(Image $image) { $this->xml->startElement('Message'); $this->xml->writeElement('MessageID', $this->messageCount); $this->xml->writeElement('OperationType', 'Update'); $image->writeXml(); $this->xml->endElement(); $this->messageCount++; return $this; }
/** * @depends testImageFeed */ public function testAddImage() { $client = $this->getServiceBuilder()->get('test.mws'); $feed = $client->getFeed('image'); $image = new Image($feed->getXml()); $image->setSku('ASDF')->setImageLocation('http://www.example.org'); $feed->addImage($image); $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 ProductImage', 1, $dom, null, false); }