force the overriding of the calculate class
This commit is contained in:
parent
2b1409222c
commit
920b36d728
2 changed files with 23 additions and 7 deletions
|
|
@ -60,6 +60,19 @@ sub _buildObj {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 calculate ( )
|
||||
|
||||
This method calculates how much it costs to ship the contents of a cart. This method
|
||||
MUST be overridden in all child classes.
|
||||
|
||||
=cut
|
||||
|
||||
sub calculate {
|
||||
croak "You must override the calculate method";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 className ( )
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ my $session = WebGUI::Test->session;
|
|||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
my $tests = 28;
|
||||
my $tests = 29;
|
||||
plan tests => 1 + $tests;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -238,6 +238,15 @@ is($driver->getId, $driverCopy->getId, 'same id');
|
|||
is($driver->className, $driverCopy->className, 'same className');
|
||||
cmp_deeply($driver->options, $driverCopy->options, 'same options');
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# calculate
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
eval { $driver->calculate; };
|
||||
like ($@, qr/^You must override the calculate method/, 'calculate throws an exception to force overriding it in the child classes');
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# delete
|
||||
|
|
@ -251,12 +260,6 @@ is($count, 0, 'delete deleted the object');
|
|||
|
||||
undef $driver;
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# calculate
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue