Add a few more tests to hit coverage. Check for non-numeric package IDs.

This commit is contained in:
Colin Kuskie 2009-11-07 12:56:43 -08:00
parent bfc05ddc7a
commit e647c013b9
2 changed files with 93 additions and 5 deletions

View file

@ -192,7 +192,7 @@ sub _calculateFromXML {
foreach my $package (@{ $xmlData->{IntlRateResponse}->{Package} }) {
my $id = $package->{ID};
##Error check for invalid index
if ($id < 0 || $id > $#shippableUnits) {
if ($id < 0 || $id > $#shippableUnits || $id !~ /^\d+$/) {
WebGUI::Error::Shop::RemoteShippingRate->throw(error => "Illegal package index returned by USPS: $id");
}
if (exists $package->{Error}) {