public function testLengthDimension()
 {
     $xml = new \XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString("\t");
     $node = new LengthDimension(1, 'IN');
     $node->setValue(1)->setUnitOfMeasure('IN');
     $node->writeXml($xml, 'LengthDimension');
     $dom = new \DOMDocument();
     $dom->loadXML($xml->outputMemory(true));
     $this->assertTrue($dom->schemaValidate(__DIR__ . '/../../../../XSD/DataType.xsd'));
 }
 /**
  * @depends testAbstractFeedItem
  * @depends testSet
  * @depends testAdd
  */
 public function testWriteNode()
 {
     $item = $this->getItem();
     $item->set('Field1', 'Foo');
     $item->add('Field2', 'Bar');
     $item->add('Field2', 'Baz');
     $item->add('Field3', DataType\LengthDimension::factory('1', 'IN'));
     $item->writeNode('Field1')->writeNode('Field2')->writeNode('Field3');
 }
 public function testJewelryWatchProduct()
 {
     $xml = new \XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString("\t");
     $product = new JewelryWatchProduct($xml);
     $product->setSku('ASDF')->setTitle('Test')->setBandColor('Blue')->setBandLength('7')->setBandMaterial('Rubber')->setBandWidth(DataType\LengthDimension::factory('1', 'IN'))->setBattery(DataType\Battery::factory(true, true, 'battery_type_2/3A', 2))->setBatteryTypeLithiumIon(1)->setBatteryTypeLithiumMetal(1)->setBezelMaterial('Metal')->setCalendarType('Wheel')->setCaseMaterial('Metal')->setCaseSizeDiameter(DataType\LengthDimension::factory('1', 'IN'))->setCaseSizeThickness(DataType\LengthDimension::factory('0.25', 'IN'))->setClaspType('Foo')->setCountryOfOrigin('CN')->setCrystal('Glass')->setDialColor('White')->setDialColorMap('Blah')->setDisplayType('Foo')->setEstatePeriod('60')->setGemType('Diamond')->setItemShape('Round')->setLithiumBatteryEnergyContent('350')->setLithiumBatteryPackaging('batteries_contained_in_equipment')->setLithiumBatteryVoltage('3.6')->setLithiumBatteryWeight('1oz')->setMaximumWaterPressure(DataType\PressureDimension::factory('2', 'bars'))->setMetalStamp('test')->setModelYear('2011')->setMovementType('Quartz')->setNumberOfLithiumIonCells('1')->setNumberOfLithiumMetalCells('1')->setParentage('child')->setResaleType('test')->setSeason('Summer')->setSellerWarrantyDescription('1 Year')->setSpecialFeatures('Waterproof')->setVariationTheme('BandColor')->setWarrantyType('1 Year')->setWaterResistantDepth(DataType\LengthDimension::factory(150, 'M'));
     $product->writeXml();
     $dom = new \DOMDocument();
     $dom->loadXML($xml->outputMemory(true));
     $this->assertTrue($dom->schemaValidate(__DIR__ . '/../../../XSD/Product.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());
 }
 public function testClothingProduct()
 {
     $xml = new \XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString("\t");
     $product = new ClothingProduct($xml);
     $product->setSKU('Foo')->setTitle('Sample')->addDepartment('foo')->addEventKeywords('Running')->addExternalTestingCertification('foo')->addMaterialAndFabric('Cotton')->addOccasionAndLifestyle('Athletic')->addPerformanceRating('Sunproof')->addSpecialSizeType('bar')->addSpecificUses('baz')->addStyleKeywords('rad')->setApparelClosureType('Button')->setBeltLength(DataType\LengthDimension::factory('1', 'IN'))->setBeltWidth(DataType\LengthDimension::factory('2', 'IN'))->setBraBandSize(DataType\LengthDimension::factory('3', 'IN'))->setCareInstructions('Machine wash cold')->setChestSize(DataType\ClothingSizeDimension::factory('4', 'IN'))->setClothingType('Shirt')->setCollarType('asdf')->setColor('Blue')->setColorMap('Cow')->setCountryOfOrigin('CN')->setCupSize('DD')->setFurisodeLength(DataType\LengthDimension::factory('5', 'IN'))->setFurisodeWidth(DataType\LengthDimension::factory('6', 'IN'))->setHeelHeight(DataType\LengthDimension::factory('7', 'IN'))->setInnerMaterial('Silk')->setInseamLength(DataType\ClothingSizeDimension::factory('8', 'IN'))->setIsAdultProduct(false)->setIsCustomizable(true)->setMaterialComposition('test')->setMaterialOpacity('50')->setMaximumHeightRecommended(DataType\LengthDimension::factory('9', 'IN'))->setMinimumHeightRecommended(DataType\LengthDimension::factory('10', 'IN'))->setModelName('foobar')->setModelNumber('001')->setModelYear('2011')->setNeckSize(DataType\ClothingSizeDimension::factory('11', 'IN'))->setObiLength(DataType\LengthDimension::factory('12', 'IN'))->setObiWidth(DataType\LengthDimension::factory('13', 'IN'))->setOuterMaterial('Wool')->setParentage('child')->setPillowSize('Large')->setProductSpecification('Testing')->setSeason('Summer')->setShaftDiameter('0.75 IN')->setShoeClosureType('Lace')->setShoeWidth('D')->setSize('11')->setSizeMap('11, 12, 13')->setSleeveLength(DataType\ClothingSizeDimension::factory('14', 'IN'))->setSleeveType('Banana')->setSoleMaterial('Rubber')->setStyleName('Derilicte')->setTsukeobiWidth(DataType\LengthDimension::factory('15', 'IN'))->setTsukeobiHeight(DataType\LengthDimension::factory('16', 'IN'))->setVariationTheme('Size')->setWaistSize(DataType\ClothingSizeDimension::factory('17', 'IN'))->setWaistStyle('Baz')->setWarnings('Foo');
     $product->writeXml();
     $dom = new \DOMDocument();
     $dom->loadXML($xml->outputMemory(true));
     $this->assertTrue($dom->schemaValidate(__DIR__ . '/../../../XSD/Product.xsd'));
 }
 public function testSpatialDimensions()
 {
     $xml = new \XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString("\t");
     $node = new SpatialDimensions(LengthDimension::factory(1, 'IN'), LengthDimension::factory(2, 'IN'), LengthDimension::factory(3, 'IN'));
     $node->setLength(LengthDimension::factory(1, 'IN'))->setWidth(LengthDimension::factory(2, 'IN'))->setHeight(LengthDimension::factory(3, 'IN'));
     $node->writeXml($xml, 'SpatialDimensions');
     $dom = new \DOMDocument();
     $dom->loadXML($xml->outputMemory(true));
     $this->assertTrue($dom->schemaValidate(__DIR__ . '/../../../../XSD/DataType.xsd'));
 }
 /**
  * @depends testAbstractDimension
  */
 public function testSetUnitOfMeasure()
 {
     $dim = new LengthDimension();
     $this->setExpectedException('InvalidArgumentException');
     $dim->setUnitOfMeasure('Foo');
 }