Start working on the new method, with tests.
Refactor out the object building code into a private method to be shared by new and create.
This commit is contained in:
parent
b174ce51fb
commit
669bb870eb
2 changed files with 73 additions and 12 deletions
|
|
@ -29,7 +29,7 @@ my $session = WebGUI::Test->session;
|
|||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
my $tests = 15;
|
||||
my $tests = 18;
|
||||
plan tests => 1 + $tests;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -167,6 +167,23 @@ is($count, 0, 'delete deleted the object');
|
|||
|
||||
undef $driver;
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# new
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
my $oldDriver;
|
||||
|
||||
eval { $oldDriver = WebGUI::Shop::ShipDriver->new(); };
|
||||
like ($@, qr/^new requires a session object/, 'new croaks without a session object');
|
||||
|
||||
eval { $oldDriver = WebGUI::Shop::ShipDriver->new($session); };
|
||||
like ($@, qr/^new requires a shipperId/, 'new croaks without a shipperId');
|
||||
|
||||
eval { $oldDriver = WebGUI::Shop::ShipDriver->new($session, 'notEverAnId'); };
|
||||
like ($@, qr/^The requested shipperId does not exist in the db/, 'new croaks unless the requested shipperId object exists in the db');
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# calculate
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue