From 499feb420bfd0d40cab227ea5f020a5b107b0924 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 14 Oct 2010 19:31:04 -0700 Subject: [PATCH] Fix naming problem with shippingServices, update tests. --- lib/WebGUI/Shop/ShipDriver/UPS.pm | 2 +- t/Shop/ShipDriver/UPS.t | 39 ++++++++++++------------------- 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/lib/WebGUI/Shop/ShipDriver/UPS.pm b/lib/WebGUI/Shop/ShipDriver/UPS.pm index 77c962190..a18799049 100644 --- a/lib/WebGUI/Shop/ShipDriver/UPS.pm +++ b/lib/WebGUI/Shop/ShipDriver/UPS.pm @@ -89,7 +89,7 @@ property shipService => ( options => \&_shippingServices_options, default => '03', ); -sub _shipService_options { +sub _shippingServices_options { my $session = shift->session; my $i18n = WebGUI::International->new($session, 'ShipDriver_UPS'); tie my %shippingServices, 'Tie::IxHash'; diff --git a/t/Shop/ShipDriver/UPS.t b/t/Shop/ShipDriver/UPS.t index 9a85f58ff..7c8424501 100644 --- a/t/Shop/ShipDriver/UPS.t +++ b/t/Shop/ShipDriver/UPS.t @@ -37,7 +37,7 @@ $session->user({user => $user}); #---------------------------------------------------------------------------- # Tests -plan tests => 36; +plan tests => 38; #---------------------------------------------------------------------------- # put your tests here @@ -176,9 +176,8 @@ cmp_deeply( '... checking error message', ); -my $properties = $driver->get(); -$properties->{sourceZip} = '97123'; -$driver->update($properties); +$driver->sourceZip(97123); +$driver->sourceCountry(''); eval { $driver->calculate() }; $e = Exception::Class->caught(); isa_ok($e, 'WebGUI::Error::InvalidParam', 'calculate throws an exception when no source country'); @@ -190,9 +189,7 @@ cmp_deeply( '... checking error message', ); -$properties = $driver->get(); -$properties->{sourceCountry} = 'United States'; -$driver->update($properties); +$driver->sourceCountry('US'); eval { $driver->calculate() }; $e = WebGUI::Error->caught(); isa_ok($e, 'WebGUI::Error::InvalidParam', 'calculate throws an exception when no userId'); @@ -204,9 +201,7 @@ cmp_deeply( '... checking error message', ); -$properties = $driver->get(); -$properties->{userId} = 'Me'; -$driver->update($properties); +$driver->userId('Me'); eval { $driver->calculate() }; $e = Exception::Class->caught(); isa_ok($e, 'WebGUI::Error::InvalidParam', 'calculate throws an exception when no password'); @@ -218,9 +213,7 @@ cmp_deeply( '... checking error message', ); -$properties = $driver->get(); -$properties->{password} = 'knock knock'; -$driver->update($properties); +$driver->password('knock knock'); eval { $driver->calculate() }; $e = Exception::Class->caught(); isa_ok($e, 'WebGUI::Error::InvalidParam', 'calculate throws an exception when no license number'); @@ -328,17 +321,15 @@ if (! $license) { $license = "bogey"; } -$properties = $driver->get(); -$properties->{userId} = $userId; -$properties->{password} = $password; -$properties->{licenseNo} = $license; -$properties->{sourceZip} = '97123'; -$properties->{sourceCountry} = 'United States'; -$properties->{shipService} = '03'; -$properties->{pickupType} = '01'; -$properties->{customerClassification} = '04'; -$properties->{residentialIndicator} = 'residential'; -$driver->update($properties); +$driver->userId($userId); +$driver->password($password); +$driver->licenseNo($license); +$driver->sourceZip('97123'); +$driver->sourceCountry('United States'); +$driver->shipService('03'); +$driver->pickupType('01'); +$driver->customerClassification('04'); +$driver->residentialIndicator('residential'); #$driver->testMode(1);