isSupporter: tests, implementation & docs.
This commit is contained in:
parent
21080cc4d5
commit
59d824e6b8
2 changed files with 47 additions and 1 deletions
|
@ -445,6 +445,30 @@ sub getPublicAck($$$) {
|
||||||
}
|
}
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
|
=begin isSupporter
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item $donorId
|
||||||
|
|
||||||
|
Valid donor id number currently in the database. die() will occur if
|
||||||
|
the id number is not in the database already as a donor id.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
Returns the a boolean indicating whether or not the donor is a Supporter (as
|
||||||
|
opposed to an ordinary donor). undef will not be returned
|
||||||
|
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub isSupporter($$$) {
|
||||||
|
return $_[0]->_getDonorField("is_supporter", $_[1]);
|
||||||
|
}
|
||||||
|
######################################################################
|
||||||
|
|
||||||
=begin getDisplayName
|
=begin getDisplayName
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
use Test::More tests => 223;
|
use Test::More tests => 227;
|
||||||
use Test::Exception;
|
use Test::Exception;
|
||||||
use Sub::Override;
|
use Sub::Override;
|
||||||
use File::Temp qw/tempfile/;
|
use File::Temp qw/tempfile/;
|
||||||
|
@ -176,6 +176,28 @@ lives_ok { $publicAckVal = $sp->getPublicAck($sterlingId); }
|
||||||
|
|
||||||
is($publicAckVal, undef, "getPublicAck: ...and return value is correct.");
|
is($publicAckVal, undef, "getPublicAck: ...and return value is correct.");
|
||||||
|
|
||||||
|
|
||||||
|
=item isSupporter
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
my $isSupporter;
|
||||||
|
|
||||||
|
dies_ok { $isSupporter = $sp->isSupporter(0); }
|
||||||
|
"isSupporter: fails when rows are not returned but _verifyId() somehow passed";
|
||||||
|
|
||||||
|
# Replace _verifyId() to always return true
|
||||||
|
|
||||||
|
$overrideSub = Sub::Override->new( 'Supporters::_verifyId' => sub ($$) { return 1;} );
|
||||||
|
dies_ok { my $ledgerId = $sp->isSupporter(0); }
|
||||||
|
"isSupporter: fails when rows are not returned but _verifyId() somehow passed";
|
||||||
|
$overrideSub->restore;
|
||||||
|
|
||||||
|
lives_ok { $isSupporter = $sp->isSupporter($olsonId); }
|
||||||
|
"isSupporter: lives when valid id...";
|
||||||
|
|
||||||
|
is($isSupporter, 1, "isSupporter: ...and return value is correct.");
|
||||||
|
|
||||||
=item getDisplayName
|
=item getDisplayName
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
Loading…
Reference in a new issue