function test_xml_serialization_using_array_input() { $xml_fixture_filename = 'manifest/Your_Company_Name_2011-02-20_1.xml'; $expected_xml = get_normalized_xml_fixture_as_string($xml_fixture_filename); $manifest_xml = pretty_print_simple_xml_element(Manifest::createXmlFromProperties(get_manifest_from_properties())); return assert($expected_xml === $manifest_xml, 'xml mismatch'); }
/** * @return Manifest\Manifest */ function get_manifest_from_facade($randomize = false) { $accountNumber = '123456789012345'; $companyName = 'Your Company Name'; $timeStamp = new DateTime('2011-03-01 01:12:00PM EST'); $now = new DateTime('now'); $pckIdOne = $randomize ? randomized_pckid($now, 1) : 'BW00709000019'; $pckIdTwo = $randomize ? randomized_pckid($now, 2) : 'BW00709012345'; return Manifest::createManifestForAccount($accountNumber, $companyName, $timeStamp)->withPackage(Manifest::createPackageWithPckId($pckIdOne)->withOrderId('89105221002001100217')->withLastName('Doe')->withFirstName('Jane')->withMiddleInitial('S')->withAddressLines(['17 Robilliard Way'])->withCity('Sebastopol')->withProvince('Bonshaw')->withPostalCode('3356')->withCountryCode('AU')->withPckWeight('3.58')->withPckType('M')->withServiceType('PAR')->withPckDescription('Clothing')->withShippingCost('20.21')->withDutyTaxHandling('10.83')->withCustomsBarCode('LM473124829US')->withItem(Manifest::createItemForPackageWithItemId('2929840')->withItemDescription('Shirt')->withCustomsDescription('Shirt')->withQuantity(1)->withUnitPrice('10.00')->withCountryOfOrigin('US')->withHTSNumber('123456789'))->withItem(Manifest::createItemForPackageWithItemId('2929841')->withItemDescription('Pants')->withCustomsDescription('Pants')->withQuantity(2)->withUnitPrice('15.00')->withCountryOfOrigin('US')->withHTSNumber('987654321')))->withPackage(Manifest::createPackageWithPckId($pckIdTwo)->withOrderId('89105221002001100217')->withLastName('Smith')->withFirstName('John')->withMiddleInitial('Q')->withAddressLines(['28A CLIFTON ST', 'Apartment 203'])->withCity('CAMPBELLTOWN')->withProvince('SYDNEY')->withPostalCode('2560')->withCountryCode('AU')->withPhone('*****@*****.**')->withPckWeight('1.25')->withPckType('S')->withServiceType('PAR')->withPckDescription('Clothing')->withCustomsBarCode('LM473124829US')->withItem(Manifest::createItemForPackageWithItemId('123456789')->withItemDescription('Pants')->withCustomsDescription('100% cotton')->withQuantity(1)->withUnitPrice('25.00')->withCountryOfOrigin('US'))); }