Update POD for Vendor.
Add a basic Vendor test.
This commit is contained in:
parent
f2cacdf4ac
commit
dfefa8d871
2 changed files with 97 additions and 4 deletions
|
|
@ -121,7 +121,7 @@ A hash reference of optional flags.
|
||||||
|
|
||||||
=head4 asHashRef
|
=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
|
=cut
|
||||||
|
|
||||||
|
|
@ -142,15 +142,18 @@ sub getVendors {
|
||||||
|
|
||||||
=head2 new ( session, vendorId )
|
=head2 new ( session, vendorId )
|
||||||
|
|
||||||
Constructor.
|
Constructor. Returns a WebGUI::Shop::Vendor object.
|
||||||
|
|
||||||
=head3 session
|
=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
|
=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
|
=cut
|
||||||
|
|
||||||
|
|
@ -224,6 +227,22 @@ A hash reference that contains one of the following:
|
||||||
|
|
||||||
The name of the vendor.
|
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
|
=cut
|
||||||
|
|
||||||
sub update {
|
sub update {
|
||||||
|
|
|
||||||
74
t/Shop/Vendor.t
Normal file
74
t/Shop/Vendor.t
Normal file
|
|
@ -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 {
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue