base work for ShipperDriver module with tests
This commit is contained in:
parent
dff8f24ea9
commit
995ae35bb0
2 changed files with 146 additions and 0 deletions
58
lib/WebGUI/Shop/ShipperDriver.pm
Normal file
58
lib/WebGUI/Shop/ShipperDriver.pm
Normal file
|
|
@ -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;
|
||||
88
t/Shop/ShipperDriver.t
Normal file
88
t/Shop/ShipperDriver.t
Normal file
|
|
@ -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 {
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue