From cf5dfda32e53371d66df9b3f41c9481ece20521c Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Fri, 22 Feb 2008 04:48:21 +0000 Subject: [PATCH] Add more tests for the object instanciated by create. Still needs a db interface, though. --- t/Shop/ShipDriver.t | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/t/Shop/ShipDriver.t b/t/Shop/ShipDriver.t index 981a27be7..e19325ab8 100644 --- a/t/Shop/ShipDriver.t +++ b/t/Shop/ShipDriver.t @@ -28,7 +28,7 @@ my $session = WebGUI::Test->session; #---------------------------------------------------------------------------- # Tests -my $tests = 4; +my $tests = 9; plan tests => 1 + $tests; #---------------------------------------------------------------------------- @@ -104,11 +104,23 @@ like ($@, qr/You must pass a hashref of options to create a new ShipDriver objec eval { $driver = WebGUI::Shop::ShipDriver->create($session, {}); }; like ($@, qr/You must pass a hashref of options to create a new ShipDriver object/, 'create croaks with an empty hashref of options'); -#isa_ok($driver, 'WebGUI::Shop::ShipDriver'); -# -#isa_ok($driver->session, 'WebGUI::Session', 'session method returns a session object'); -# -#is($session->getId, $driver->session->getId, 'session method returns OUR session object'); +$driver = WebGUI::Shop::ShipDriver->create( + $session, + { + label => 'Slow and dangerous', + enabled => 1, + } + ); + +isa_ok($driver, 'WebGUI::Shop::ShipDriver'); + +isa_ok($driver->session, 'WebGUI::Session', 'session method returns a session object'); + +is($session->getId, $driver->session->getId, 'session method returns OUR session object'); + +like($driver->shipperId, $session->id->getValidator, 'got a valid GUID for shipperId'); + +is($driver->className, ref $driver, 'className property set correctly'); ####################################################################### #