public function testWeightDimension()
 {
     $xml = new \XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString("\t");
     $node = new WeightDimension(1, 'LB');
     $node->setValue(1)->setUnitOfMeasure('LB');
     $node->writeXml($xml, 'WeightDimension');
     $dom = new \DOMDocument();
     $dom->loadXML($xml->outputMemory(true));
     $this->assertTrue($dom->schemaValidate(__DIR__ . '/../../../../XSD/DataType.xsd'));
 }
 public function testSportsProduct()
 {
     $xml = new \XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString("\t");
     $product = new SportsProduct($xml);
     $product->setSku('ASDF')->setTitle('Test')->setAgeGenderCategory('5+')->setAmperage(DataType\AmperageDimension::factory(1, 'amps'))->setBikeRimSize(DataType\LengthDimension::factory(26, 'IN'))->setBootSize('11')->setBounce('asdf')->setCalfSize('Small')->setCaliber('.45')->setCapacity(DataType\VolumeDimension::factory(1, 'cup'))->setClub('foo')->setColor('Blue')->setCurvature('Bar')->setDesign('asdf')->setDiameter(DataType\LengthDimension::factory(1, 'IN'))->setDivingHoodThickness(DataType\LengthDimension::factory(1, 'MM'))->setFencingPommelType('blah')->setFlavor('asdf')->setGolfFlex('blah')->setGolfLoft(DataType\DegreeDimension::factory(1, 'degrees'))->setGripSize('Large')->setGripType('Baz')->setHand('right')->setHeadSize('mid-plus')->setHeight(DataType\LengthDimension::factory(1, 'IN'))->setIrons('9')->setIsAdultProduct(false)->setIsCustomizable(false)->setItemThickness(DataType\LengthDimension::factory(1, 'IN'))->setLength(DataType\LengthDimension::factory(2, 'IN'))->setLensColor('Black')->setLieAngle('5')->setLineCapacity('100')->setLineWeight('50')->setMaterial('Metal')->setModel('Foo')->setNumberOfItems(1)->setPackaging('Box')->setParentage('child')->setProductType('GolfClubs')->setQuantity(1)->setRounds(3)->setShaftLength(DataType\LengthDimension::factory(12, 'IN'))->setShaftMaterial('Metal')->setShaftType('attacker-shafts')->setShape('Round')->setSize('Small')->setStyle('Blah')->setTemperatureRating(DataType\TemperatureRatingDimension::factory(100, 'degrees-fahrenheit'))->setTensionLevel('High')->setVariationTheme('Size')->setVolume(DataType\VolumeDimension::factory(1, 'cup'))->setWattage(DataType\WattageDimension::factory(1, 'watts'))->setWeight(DataType\WeightDimension::factory(1, 'LB'))->setWeightSupported(DataType\WeightDimension::factory(100, 'LB'))->setWheelSize(DataType\LengthDimension::factory(15, 'IN'))->setWidth(DataType\LengthDimension::factory(24, 'IN'))->setWood(5);
     $product->writeXml();
     $dom = new \DOMDocument();
     $dom->loadXML($xml->outputMemory(true));
     $this->assertTrue($dom->schemaValidate(__DIR__ . '/../../../XSD/Product.xsd'));
 }
 public function testAbstractProduct()
 {
     $xml = new \XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString("\t");
     $product = new ClothingProduct($xml);
     $product->addBulletPoint('Foo')->addCPSIAWarning('choking_hazard_balloon')->addOtherItemAttributes('Test')->addPlatinumKeywords('Sample')->addPromotionKeywords('Test')->addRebate('50')->addSearchTerms('Foo')->addSubjectContent('Test')->addTargetAudience('asdf')->addUsedFor('Bar')->setAutographed(true)->setBrand('adidas')->setBrowseExclusion(false)->setCPSIAWarningDescription('blah')->setCondition(DataType\ConditionInfo::factory('New'))->setDeliveryChannel('direct_ship')->setDescription('How now brown cow')->setDesigner('John Doe')->setDiscontinueDate(new \DateTime('2011-01-01T00:00:00-06:00'))->setIsDiscontinuedByManufacturer(false)->setIsGiftMessageAvailable(false)->setIsGiftWrapAvailable(false)->setItemDimensions(DataType\Dimensions::factory(DataType\LengthDimension::factory(1, 'IN'), DataType\LengthDimension::factory(2, 'IN')))->setItemPackageQuantity(1)->setItemType('Shoe')->setLaunchDate(new \DateTime('2000-01-01T00:00:00-06:00'))->setLegalDisclaimer('Foo')->setManufacturer('Acme')->setMaxAggregateShipQuantity(1)->setMaxOrderQuantity(1)->setMemorabilia(false)->setMerchantCatalogNumber(1234)->setMfrPartNumber('0001')->setMsrp(DataType\CurrencyAmount::factory(100, 'USD'))->setNumberOfItems(1)->setPackageDimensions(DataType\SpatialDimensions::factory(DataType\LengthDimension::factory(1, 'IN'), DataType\LengthDimension::factory(2, 'IN'), DataType\LengthDimension::factory(3, 'IN')))->setPackageWeight(DataType\WeightDimension::factory(1, 'LB'))->setPriority(1)->setProductTaxCode('A_GEN_TAX')->setProp65(false)->setRecommendationExclusion(false)->setReleaseDate(new \DateTime('2002-01-01T00:00:00-06:00'))->setSerialNumberRequired(false)->setShippingWeight(DataType\WeightDimension::factory(1, 'LB'))->setSku('ASDF')->setStandardProductId(DataType\StandardProductId::factory('UPC', 1234))->setTitle('Sample');
     $product->writeXml();
     $dom = new \DOMDocument();
     $dom->loadXML($xml->outputMemory(true));
     //$this->assertXmlStringEqualsXmlFile(__DIR__ . '/Mock/AbstractProduct.xml', $dom->saveXML());
 }
Esempio n. 4
0
 public function testDimensions()
 {
     $xml = new \XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString("\t");
     $node = new Dimensions(LengthDimension::factory(1, 'IN'), LengthDimension::factory(2, 'IN'), LengthDimension::factory(3, 'IN'), WeightDimension::factory(4, 'LB'));
     $node->setLength(LengthDimension::factory(1, 'IN'))->setWidth(LengthDimension::factory(2, 'IN'))->setHeight(LengthDimension::factory(3, 'IN'))->setWeight(WeightDimension::factory(4, 'LB'));
     $node->writeXml($xml, 'Dimensions');
     $dom = new \DOMDocument();
     $dom->loadXML($xml->outputMemory(true));
     $this->assertTrue($dom->schemaValidate(__DIR__ . '/../../../../XSD/DataType.xsd'));
 }