diff --git a/lib/WebGUI/Shop/Vendor.pm b/lib/WebGUI/Shop/Vendor.pm index a754f2ae3..542f9c6ad 100644 --- a/lib/WebGUI/Shop/Vendor.pm +++ b/lib/WebGUI/Shop/Vendor.pm @@ -121,7 +121,7 @@ A hash reference of optional flags. =head4 asHashRef -A boolean indicating that the vendors should be returned as a hash reference of id/names rather than objects. +A boolean indicating that the vendors should be returned as a hash reference of id/names rather than an array of objects. =cut @@ -142,15 +142,18 @@ sub getVendors { =head2 new ( session, vendorId ) -Constructor. +Constructor. Returns a WebGUI::Shop::Vendor object. =head3 session -A reference to the current session. +A reference to the current session. If the session variable is not passed, then an WebGUI::Error::InvalidObject +Exception will be thrown. =head3 vendorId -A unique id for a vendor. +A unique id for a vendor that already exists in the database. If the vendorId is not passed +in, then a WebGUI::Error::InvalidParam Exception will be thrown. If the requested Id cannot +be found in the database, then a WebGUI::Error::ObjectNotFound exception will be thrown. =cut @@ -224,6 +227,22 @@ A hash reference that contains one of the following: The name of the vendor. +=head4 userId + +The name of the vendor. + +=head4 url + +The vendor's url. + +=head4 paymentInformation + +The name of the vendor. + +=head4 preferredPaymentType + +The name of the vendor. + =cut sub update { diff --git a/t/Shop/Vendor.t b/t/Shop/Vendor.t new file mode 100644 index 000000000..2353fee9f --- /dev/null +++ b/t/Shop/Vendor.t @@ -0,0 +1,74 @@ +# 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 JSON; +use HTML::Form; + +use WebGUI::Test; # Must use this before any other WebGUI modules +use WebGUI::Session; + +#---------------------------------------------------------------------------- +# Init +my $session = WebGUI::Test->session; + +#---------------------------------------------------------------------------- +# Tests + +my $tests = 2; +plan tests => 1 + $tests; + +#---------------------------------------------------------------------------- +# put your tests here + +my $loaded = use_ok('WebGUI::Shop::Vendor'); + +my $vendor; + +SKIP: { + +skip 'Unable to load module WebGUI::Shop::Vendor', $tests unless $loaded; + +####################################################################### +# +# new +# +####################################################################### + +my $e; + +eval { $vendor = WebGUI::Shop::Vendor->new(); }; +$e = Exception::Class->caught(); +isa_ok($e, 'WebGUI::Error::InvalidObject', 'new takes an exception to not giving it a session variable'); +cmp_deeply( + $e, + methods( + error => 'Need a session.', + got => '', + expected => 'WebGUI::Session', + ), + 'new: requires a session variable', +); + +} + +#---------------------------------------------------------------------------- +# Cleanup +END { +}