public function testPrice() { $xml = new \XMLWriter(); $xml->openMemory(); $xml->setIndent(true); $price = new Price($xml); $price->setDepositAmount(DataType\CurrencyAmount::factory('1.00', 'USD'))->setMAP(DataType\CurrencyAmount::factory('2.00', 'USD'))->setPrevious(DataType\DatedPrice::factory(new \DateTime('2000-01-01T00:00:00-06:00'), new \DateTime('2001-01-01T00:00:00-06:00'), DataType\CurrencyAmount::factory('3.00', 'USD')))->setSale(DataType\Sale::factory(new \DateTime('2002-01-01T00:00:00-06:00'), new \DateTime('2003-01-03T00:00:00-06:00'), DataType\CurrencyAmount::factory('4.00', 'USD')))->setSku('ASDF')->setStandardPrice(DataType\CurrencyAmount::factory('5.00', 'USD')); $price->writeXml(); $dom = new \DOMDocument(); $dom->loadXML($xml->outputMemory(true)); $this->assertTrue($dom->schemaValidate(__DIR__ . '/../../../XSD/Price.xsd')); }
/** * @depends testPriceFeed */ public function testAddPrice() { $client = $this->getServiceBuilder()->get('test.mws'); $feed = $client->getFeed('price'); $price = new Price($feed->getXml()); $price->setSku('ASDF')->setStandardPrice(DataType\CurrencyAmount::factory(10.0, 'USD')); $feed->addPrice($price); $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 Price', 1, $dom, null, false); }