diff --git a/lib/WebGUI/Shop/ShipperDriver.pm b/lib/WebGUI/Shop/ShipperDriver.pm new file mode 100644 index 000000000..30beeccaa --- /dev/null +++ b/lib/WebGUI/Shop/ShipperDriver.pm @@ -0,0 +1,58 @@ +package WebGUI::Shop::ShipperDriver; + +use strict; + +use Class::InsideOut qw{ :std }; +use Carp qw(croak); + +=head1 NAME + +Package WebGUI::Shop::ShipperDriver + +=head1 DESCRIPTION + +This package manages tax information, and calculates taxes on a shopping cart. It isn't a classic object +in that the only data it contains is a WebGUI::Session object, but it does provide several methods for +handling the information in the tax tables. + +=head1 SYNOPSIS + + use WebGUI::Shop::ShipperDriver; + + my $tax = WebGUI::Shop::ShipperDriver->new($session); + +=head1 METHODS + +These subroutines are available from this package: + +=cut + +readonly session => my %session; + +#------------------------------------------------------------------- + +=head2 new ( $session ) + +Constructor for the WebGUI::Shop::Tax. Returns a WebGUI::Shop::Tax object. + +=cut + +sub new { + my $class = shift; + my $session = shift; + my $self = {}; + bless $self, $class; + register $self; + $session{ id $self } = $session; + return $self; +} + +#------------------------------------------------------------------- + +=head2 session ( ) + +Accessor for the session object. Returns the session object. + +=cut + +1; diff --git a/t/Shop/ShipperDriver.t b/t/Shop/ShipperDriver.t new file mode 100644 index 000000000..f99d01433 --- /dev/null +++ b/t/Shop/ShipperDriver.t @@ -0,0 +1,88 @@ +# vim:syntax=perl +#------------------------------------------------------------------- +# WebGUI is Copyright 2001-2008 Plain Black Corporation. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------ +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------ + +# Write a little about what this script tests. +# +# + +use FindBin; +use strict; +use lib "$FindBin::Bin/../lib"; +use Test::More; +use Test::Deep; +use WebGUI::Test; # Must use this before any other WebGUI modules +use WebGUI::Session; + +#---------------------------------------------------------------------------- +# Init +my $session = WebGUI::Test->session; + +#---------------------------------------------------------------------------- +# Tests + +my $tests = 3; +plan tests => 1 + $tests; + +#---------------------------------------------------------------------------- +# put your tests here + +my $loaded = use_ok('WebGUI::Shop::ShipperDriver'); + +my $storage; + +SKIP: { + +skip 'Unable to load module WebGUI::Shop::ShipperDriver', $tests unless $loaded; + +####################################################################### +# +# new +# +####################################################################### + +my $driver = WebGUI::Shop::ShipperDriver->new($session); + +isa_ok($driver, 'WebGUI::Shop::ShipperDriver'); + +isa_ok($driver->session, 'WebGUI::Session', 'session method returns a session object'); + +is($session->getId, $driver->session->getId, 'session method returns OUR session object'); + +####################################################################### +# +# definition +# +####################################################################### + +####################################################################### +# +# getName +# +####################################################################### + +####################################################################### +# +# getEditForm +# +####################################################################### + +####################################################################### +# +# calculate +# +####################################################################### + +} + +#---------------------------------------------------------------------------- +# Cleanup +END { +}