Adding isVendorInfoComplete method.

This commit is contained in:
Martin Kamerbeek 2009-03-18 15:27:38 +00:00
parent 8da6751407
commit be145261e0
2 changed files with 42 additions and 1 deletions

View file

@ -194,6 +194,26 @@ sub getVendors {
#-------------------------------------------------------------------
=head2 isVendorInfoComplete ( )
Returns a boolean indicating whether the payoutinformation entered by the vendor is complete.
=cut
sub isVendorInfoComplete {
my $self = shift;
my $complete =
defined $self->get( 'name' )
&& defined $self->get( 'userId' )
&& defined $self->get( 'preferredPaymentType' )
&& defined $self->get( 'paymentInformation' );
return $complete
}
#-------------------------------------------------------------------
=head2 new ( session, vendorId )
Constructor. Returns a WebGUI::Shop::Vendor object.

View file

@ -31,7 +31,7 @@ my $session = WebGUI::Test->session;
#----------------------------------------------------------------------------
# Tests
my $tests = 44;
my $tests = 49;
plan tests => 1 + $tests;
#----------------------------------------------------------------------------
@ -283,6 +283,27 @@ cmp_deeply(
'delete removed the correct vendor'
);
#######################################################################
#
# isVendorInfoComplete
#
#######################################################################
my %completeProps = (
name => 'Esquerita',
userId => $fenceUser->userId,
preferredPaymentType => 'PayPal',
paymentInformation => 'esquerita@example.com',
);
$fence->update( { %completeProps } );
is( $fence->isVendorInfoComplete, 1, 'Vendor information is complete' );
foreach (keys %completeProps ) {
$fence->update( { %completeProps, $_ => undef } );
ok( !$fence->isVendorInfoComplete, "Vendor information is not complete without $_" );
}
undef $guard;
}