Skip to content

Commit

Permalink
Merge pull request #24 from 200MPH/develop
Browse files Browse the repository at this point in the history
Unit test updated
  • Loading branch information
200MPH authored May 6, 2020
2 parents b3833ba + 85e0046 commit 264a480
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 139 deletions.
140 changes: 1 addition & 139 deletions test/unit/ShippingRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,147 +104,9 @@ public function setUp()
public function testXmlOutput()
{

$xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ESHIPPER>
<LOGIN>
<COMPANY>user</COMPANY>
<PASSWORD>password</PASSWORD>
<APPID>IN</APPID>
<APPVERSION>3.0</APPVERSION>
</LOGIN>
<CONSIGNMENTBATCH>
<GROUPCODE>123456789</GROUPCODE>
<SENDER><ACCOUNT><![CDATA[A1234]]></ACCOUNT>
<COMPANYNAME><![CDATA[Test Company]]></COMPANYNAME>
<STREETADDRESS1><![CDATA[Address line 1]]></STREETADDRESS1>
<STREETADDRESS2><![CDATA[Address line 2]]></STREETADDRESS2>
<STREETADDRESS3><![CDATA[Address line 3]]></STREETADDRESS3>
<CITY><![CDATA[City]]></CITY>
<PROVINCE><![CDATA[Province]]></PROVINCE>
<POSTCODE><![CDATA[Post code]]></POSTCODE>
<COUNTRY><![CDATA[Country]]></COUNTRY>
<VAT><![CDATA[123123]]></VAT>
<CONTACTNAME><![CDATA[Aren]]></CONTACTNAME>
<CONTACTDIALCODE><![CDATA[Dial code]]></CONTACTDIALCODE>
<CONTACTTELEPHONE><![CDATA[Contact phone]]></CONTACTTELEPHONE>
<CONTACTEMAIL><![CDATA[Email]]></CONTACTEMAIL>
<COLLECTION><COLLECTIONADDRESS>
<COMPANYNAME><![CDATA[Test Company]]></COMPANYNAME>
<STREETADDRESS1><![CDATA[Address line 1]]></STREETADDRESS1>
<STREETADDRESS2><![CDATA[Address line 2]]></STREETADDRESS2>
<STREETADDRESS3><![CDATA[Address line 3]]></STREETADDRESS3>
<CITY><![CDATA[City]]></CITY>
<PROVINCE><![CDATA[Province]]></PROVINCE>
<POSTCODE><![CDATA[Post code]]></POSTCODE>
<COUNTRY><![CDATA[Country]]></COUNTRY>
<VAT><![CDATA[123123]]></VAT>
<CONTACTNAME><![CDATA[Aren]]></CONTACTNAME>
<CONTACTDIALCODE><![CDATA[Dial code]]></CONTACTDIALCODE>
<CONTACTTELEPHONE><![CDATA[Contact phone]]></CONTACTTELEPHONE>
<CONTACTEMAIL><![CDATA[Email]]></CONTACTEMAIL>
</COLLECTIONADDRESS>
<SHIPDATE><![CDATA[16/01/2018]]></SHIPDATE>
<PREFCOLLECTTIME>
<FROM><![CDATA[10:00]]></FROM>
<TO><![CDATA[12:00]]></TO>
</PREFCOLLECTTIME>
<ALTCOLLECTTIME>
<FROM><![CDATA[12:00]]></FROM>
<TO><![CDATA[14:00]]></TO>
</ALTCOLLECTTIME>
<COLLINSTRUCTIONS><![CDATA[Collection instruction]]></COLLINSTRUCTIONS>
</COLLECTION>
</SENDER>
<CONSIGNMENT><CONREF>GB123456789</CONREF>
<DETAILS>
<RECEIVER><COMPANYNAME><![CDATA[Company name]]></COMPANYNAME>
<STREETADDRESS1><![CDATA[Address 1]]></STREETADDRESS1>
<STREETADDRESS2><![CDATA[Address 2]]></STREETADDRESS2>
<STREETADDRESS3><![CDATA[Address 3]]></STREETADDRESS3>
<CITY><![CDATA[City]]></CITY>
<PROVINCE><![CDATA[Province]]></PROVINCE>
<POSTCODE><![CDATA[12345]]></POSTCODE>
<COUNTRY><![CDATA[GB]]></COUNTRY>
<VAT><![CDATA[123456]]></VAT>
<CONTACTNAME><![CDATA[Name]]></CONTACTNAME>
<CONTACTDIALCODE><![CDATA[+48]]></CONTACTDIALCODE>
<CONTACTTELEPHONE><![CDATA[123456789]]></CONTACTTELEPHONE>
<CONTACTEMAIL><![CDATA[email@email]]></CONTACTEMAIL>
<ACCOUNT><![CDATA[ACC123]]></ACCOUNT>
<ACCOUNTCOUNTRY><![CDATA[PL]]></ACCOUNTCOUNTRY>
</RECEIVER>
<DELIVERY><COMPANYNAME><![CDATA[Company name]]></COMPANYNAME>
<STREETADDRESS1><![CDATA[Address 1]]></STREETADDRESS1>
<STREETADDRESS2><![CDATA[Address 2]]></STREETADDRESS2>
<STREETADDRESS3><![CDATA[Address 3]]></STREETADDRESS3>
<CITY><![CDATA[City]]></CITY>
<PROVINCE><![CDATA[Province]]></PROVINCE>
<POSTCODE><![CDATA[12345]]></POSTCODE>
<COUNTRY><![CDATA[GB]]></COUNTRY>
<VAT><![CDATA[123456]]></VAT>
<CONTACTNAME><![CDATA[Name]]></CONTACTNAME>
<CONTACTDIALCODE><![CDATA[+48]]></CONTACTDIALCODE>
<CONTACTTELEPHONE><![CDATA[123456789]]></CONTACTTELEPHONE>
<CONTACTEMAIL><![CDATA[email@email]]></CONTACTEMAIL>
<ACCOUNT><![CDATA[ACC123]]></ACCOUNT>
<ACCOUNTCOUNTRY><![CDATA[PL]]></ACCOUNTCOUNTRY>
</DELIVERY>
<CUSTOMERREF><![CDATA[123456789]]></CUSTOMERREF>
<CONTYPE><![CDATA[N]]></CONTYPE>
<PAYMENTIND><![CDATA[S]]></PAYMENTIND>
<ITEMS><![CDATA[0]]></ITEMS>
<TOTALWEIGHT><![CDATA[0]]></TOTALWEIGHT>
<TOTALVOLUME><![CDATA[0]]></TOTALVOLUME>
<CURRENCY><![CDATA[GBP]]></CURRENCY>
<GOODSVALUE><![CDATA[0]]></GOODSVALUE>
<INSURANCEVALUE><![CDATA[0]]></INSURANCEVALUE>
<INSURANCECURRENCY><![CDATA[GBP]]></INSURANCECURRENCY>
<SERVICE><![CDATA[15N]]></SERVICE>
<OPTION><![CDATA[PR]]></OPTION>
<DESCRIPTION><![CDATA[Description]]></DESCRIPTION>
<DELIVERYINST><![CDATA[Del. instruction]]></DELIVERYINST>
<HAZARDOUS><![CDATA[Y]]></HAZARDOUS>
<UNNUMBER><![CDATA[1234]]></UNNUMBER>
<PACKINGGROUP><![CDATA[II]]></PACKINGGROUP>
<PACKAGE><ITEMS><![CDATA[0]]></ITEMS>
<DESCRIPTION><![CDATA[]]></DESCRIPTION>
<LENGTH><![CDATA[0]]></LENGTH>
<HEIGHT><![CDATA[0]]></HEIGHT>
<WIDTH><![CDATA[0]]></WIDTH>
<WEIGHT><![CDATA[0]]></WEIGHT>
<ARTICLE><ITEMS><![CDATA[0]]></ITEMS>
<DESCRIPTION><![CDATA[]]></DESCRIPTION>
<WEIGHT><![CDATA[0]]></WEIGHT>
<INVOICEVALUE><![CDATA[0]]></INVOICEVALUE>
<INVOICEDESC><![CDATA[Desc]]></INVOICEDESC>
<HTS><![CDATA[0]]></HTS>
<COUNTRY><![CDATA[GB]]></COUNTRY>
<EMRN><![CDATA[EMRN]]></EMRN>
</ARTICLE>
</PACKAGE>
</DETAILS>
</CONSIGNMENT>
</CONSIGNMENTBATCH>
<ACTIVITY><CREATE>
<CONREF><![CDATA[GB123456789]]></CONREF>
</CREATE>
<BOOK ShowBookingRef="Y">
<CONREF><![CDATA[GB123456789]]></CONREF>
</BOOK>
<SHIP>
<CONREF><![CDATA[GB123456789]]></CONREF>
</SHIP>
<PRINT><REQUIRED>
<CONREF><![CDATA[GB123456789]]></CONREF>
</REQUIRED>
</PRINT>
<SHOW_GROUPCODE/>
</ACTIVITY>
</ESHIPPER>';

$xml = file_get_contents(__DIR__ . '/shipping_test.xml');
$xml1 = new \SimpleXMLElement($xml);
$xml2 = new \SimpleXMLElement($this->shipping->getXmlContent());

$this->assertEquals($xml1->asXML(), $xml2->asXML());
}
}
122 changes: 122 additions & 0 deletions test/unit/shipping_test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ESHIPPER>
<LOGIN>
<COMPANY>user</COMPANY>
<PASSWORD>password</PASSWORD>
<APPID>IN</APPID>
<APPVERSION>3.0</APPVERSION>
</LOGIN>
<CONSIGNMENTBATCH>
<GROUPCODE>123456789</GROUPCODE>
<SENDER><COMPANYNAME><![CDATA[Test Company]]></COMPANYNAME>
<STREETADDRESS1><![CDATA[Address line 1]]></STREETADDRESS1>
<STREETADDRESS2><![CDATA[Address line 2]]></STREETADDRESS2>
<STREETADDRESS3><![CDATA[Address line 3]]></STREETADDRESS3>
<CITY><![CDATA[City]]></CITY>
<PROVINCE><![CDATA[Province]]></PROVINCE>
<POSTCODE><![CDATA[Post code]]></POSTCODE>
<COUNTRY><![CDATA[Country]]></COUNTRY>
<VAT><![CDATA[123123]]></VAT>
<CONTACTNAME><![CDATA[Aren]]></CONTACTNAME>
<CONTACTDIALCODE><![CDATA[Dial code]]></CONTACTDIALCODE>
<CONTACTTELEPHONE><![CDATA[Contact phone]]></CONTACTTELEPHONE>
<CONTACTEMAIL><![CDATA[Email]]></CONTACTEMAIL> <COLLECTION><COLLECTIONADDRESS><COMPANYNAME><![CDATA[Test Company]]></COMPANYNAME>
<STREETADDRESS1><![CDATA[Address line 1]]></STREETADDRESS1>
<STREETADDRESS2><![CDATA[Address line 2]]></STREETADDRESS2>
<STREETADDRESS3><![CDATA[Address line 3]]></STREETADDRESS3>
<CITY><![CDATA[City]]></CITY>
<PROVINCE><![CDATA[Province]]></PROVINCE>
<POSTCODE><![CDATA[Post code]]></POSTCODE>
<COUNTRY><![CDATA[Country]]></COUNTRY>
<VAT><![CDATA[123123]]></VAT>
<CONTACTNAME><![CDATA[Aren]]></CONTACTNAME>
<CONTACTDIALCODE><![CDATA[Dial code]]></CONTACTDIALCODE>
<CONTACTTELEPHONE><![CDATA[Contact phone]]></CONTACTTELEPHONE>
<CONTACTEMAIL><![CDATA[Email]]></CONTACTEMAIL></COLLECTIONADDRESS>
<SHIPDATE><![CDATA[16/01/2018]]></SHIPDATE>
<PREFCOLLECTTIME>
<FROM><![CDATA[10:00]]></FROM>
<TO><![CDATA[12:00]]></TO>
</PREFCOLLECTTIME>
<ALTCOLLECTTIME>
<FROM><![CDATA[12:00]]></FROM>
<TO><![CDATA[14:00]]></TO>
</ALTCOLLECTTIME>
<COLLINSTRUCTIONS><![CDATA[Collection instruction]]></COLLINSTRUCTIONS></COLLECTION>
</SENDER>
<CONSIGNMENT><CONREF>GB123456789</CONREF>
<DETAILS>
<RECEIVER><COMPANYNAME><![CDATA[Company name]]></COMPANYNAME>
<STREETADDRESS1><![CDATA[Address 1]]></STREETADDRESS1>
<STREETADDRESS2><![CDATA[Address 2]]></STREETADDRESS2>
<STREETADDRESS3><![CDATA[Address 3]]></STREETADDRESS3>
<CITY><![CDATA[City]]></CITY>
<PROVINCE><![CDATA[Province]]></PROVINCE>
<POSTCODE><![CDATA[12345]]></POSTCODE>
<COUNTRY><![CDATA[GB]]></COUNTRY>
<VAT><![CDATA[123456]]></VAT>
<CONTACTNAME><![CDATA[Name]]></CONTACTNAME>
<CONTACTDIALCODE><![CDATA[+48]]></CONTACTDIALCODE>
<CONTACTTELEPHONE><![CDATA[123456789]]></CONTACTTELEPHONE>
<CONTACTEMAIL><![CDATA[email@email]]></CONTACTEMAIL>
<ACCOUNT><![CDATA[ACC123]]></ACCOUNT>
<ACCOUNTCOUNTRY><![CDATA[PL]]></ACCOUNTCOUNTRY></RECEIVER>
<DELIVERY><COMPANYNAME><![CDATA[Company name]]></COMPANYNAME>
<STREETADDRESS1><![CDATA[Address 1]]></STREETADDRESS1>
<STREETADDRESS2><![CDATA[Address 2]]></STREETADDRESS2>
<STREETADDRESS3><![CDATA[Address 3]]></STREETADDRESS3>
<CITY><![CDATA[City]]></CITY>
<PROVINCE><![CDATA[Province]]></PROVINCE>
<POSTCODE><![CDATA[12345]]></POSTCODE>
<COUNTRY><![CDATA[GB]]></COUNTRY>
<CONTACTNAME><![CDATA[Name]]></CONTACTNAME>
<CONTACTDIALCODE><![CDATA[+48]]></CONTACTDIALCODE>
<CONTACTTELEPHONE><![CDATA[123456789]]></CONTACTTELEPHONE>
<CONTACTEMAIL><![CDATA[email@email]]></CONTACTEMAIL></DELIVERY>
<CUSTOMERREF><![CDATA[123456789]]></CUSTOMERREF>
<CONTYPE><![CDATA[N]]></CONTYPE>
<PAYMENTIND><![CDATA[S]]></PAYMENTIND>
<ITEMS><![CDATA[0]]></ITEMS>
<TOTALWEIGHT><![CDATA[0]]></TOTALWEIGHT>
<TOTALVOLUME><![CDATA[0]]></TOTALVOLUME>
<CURRENCY><![CDATA[GBP]]></CURRENCY>
<GOODSVALUE><![CDATA[0]]></GOODSVALUE>
<INSURANCEVALUE><![CDATA[0]]></INSURANCEVALUE>
<INSURANCECURRENCY><![CDATA[GBP]]></INSURANCECURRENCY>
<SERVICE><![CDATA[15N]]></SERVICE>
<OPTION><![CDATA[PR]]></OPTION>
<DESCRIPTION><![CDATA[Description]]></DESCRIPTION>
<DELIVERYINST><![CDATA[Del. instruction]]></DELIVERYINST>
<HAZARDOUS><![CDATA[Y]]></HAZARDOUS>
<UNNUMBER><![CDATA[1234]]></UNNUMBER>
<PACKINGGROUP><![CDATA[II]]></PACKINGGROUP> <PACKAGE><ITEMS><![CDATA[0]]></ITEMS>
<DESCRIPTION><![CDATA[]]></DESCRIPTION>
<LENGTH><![CDATA[0]]></LENGTH>
<HEIGHT><![CDATA[0]]></HEIGHT>
<WIDTH><![CDATA[0]]></WIDTH>
<WEIGHT><![CDATA[0]]></WEIGHT><ARTICLE><ITEMS><![CDATA[0]]></ITEMS>
<DESCRIPTION><![CDATA[]]></DESCRIPTION>
<WEIGHT><![CDATA[0]]></WEIGHT>
<INVOICEVALUE><![CDATA[0]]></INVOICEVALUE>
<INVOICEDESC><![CDATA[Desc]]></INVOICEDESC>
<HTS><![CDATA[0]]></HTS>
<COUNTRY><![CDATA[GB]]></COUNTRY>
<EMRN><![CDATA[EMRN]]></EMRN></ARTICLE>
</PACKAGE>
</DETAILS></CONSIGNMENT>
</CONSIGNMENTBATCH>
<ACTIVITY><CREATE>
<CONREF><![CDATA[GB123456789]]></CONREF>
</CREATE>
<BOOK ShowBookingRef="Y">
<CONREF><![CDATA[GB123456789]]></CONREF>
</BOOK>
<SHIP>
<CONREF><![CDATA[GB123456789]]></CONREF>
</SHIP>
<PRINT><REQUIRED>
<CONREF><![CDATA[GB123456789]]></CONREF>
</REQUIRED>
</PRINT>
<SHOW_GROUPCODE/>
</ACTIVITY></ESHIPPER>

0 comments on commit 264a480

Please sign in to comment.