Begin implementation of addPostalAddress.
These tests mostly fail, although a few pass automatically: not ok 26 - addPostalAddress: dies for undefined id not ok 27 - addPostalAddress: dies for non-numeric id not ok 28 - addPostalAddress: postal address undefined fails ok 29 - addPostalAddress: type is not added when other input paramaters are invalid ok 30 - addPostalAddress: addPostalAddress of a valid formatted_address works. ok 30 - addPostalAddress: addPostalAddress of a valid formatted_address works. not ok 31 - addPostalAddress: id returned is sane. Goal is to implement those and make sure they all pass.
This commit is contained in:
parent
bb84d6ad31
commit
5d8d480223
2 changed files with 60 additions and 1 deletions
|
@ -207,6 +207,39 @@ sub addEmailAddress($$$$) {
|
||||||
}
|
}
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
|
=begin addPostalAddress
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item $id
|
||||||
|
|
||||||
|
Valid supporter id number currently in the database. die() will occur if
|
||||||
|
the id number is not in the database already as a supporter id.
|
||||||
|
|
||||||
|
=item $formattedPostalAddress
|
||||||
|
|
||||||
|
Scalar string that contains a multi-line, fully formatted, postal address.
|
||||||
|
|
||||||
|
=item $addressType
|
||||||
|
|
||||||
|
Scalar string that contains the address type. This type will be created in
|
||||||
|
the database if it does not already exist, so be careful.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
Returns the id value of the postal_address table entry.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub addPostalAddress($$$$) {
|
||||||
|
my($self, $id, $formattedPostalAddress, $addressType) = @_;
|
||||||
|
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
######################################################################
|
||||||
|
|
||||||
=begin getRequestType
|
=begin getRequestType
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
use Test::More tests => 55;
|
use Test::More tests => 61;
|
||||||
use Test::Exception;
|
use Test::Exception;
|
||||||
|
|
||||||
use Scalar::Util qw(looks_like_number reftype);
|
use Scalar::Util qw(looks_like_number reftype);
|
||||||
|
@ -144,6 +144,32 @@ ok($same = $sp->addAddressType("paypal payer"), "addAddressType: lookup works");
|
||||||
|
|
||||||
ok($same == $paypalPayerAddressType, "addAddressType: lookup returns same as the basic add");
|
ok($same == $paypalPayerAddressType, "addAddressType: lookup returns same as the basic add");
|
||||||
|
|
||||||
|
=item addPostalAddress
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
dies_ok { $sp->addPostalAddress(undef, "405 Madison Avenue\nNew York, NY 10000\nUSA", 'office'); }
|
||||||
|
"addPostalAddress: dies for undefined id";
|
||||||
|
dies_ok { $sp->addPostalAddress("String", "405 Madison Avenue\nNew York, NY 10000\nUSA", 'office'); }
|
||||||
|
"addPostalAddress: dies for non-numeric id";
|
||||||
|
dies_ok { $sp->addPostalAddress($drapperId, undef, 'work') }
|
||||||
|
"addPostalAddress: postal address undefined fails";
|
||||||
|
|
||||||
|
# Verify that the addressType wasn't added when the Email address is invalid
|
||||||
|
# and the address type did not already exist.
|
||||||
|
|
||||||
|
$val = $sp->dbh()->selectall_hashref("SELECT id, name FROM address_type WHERE name = 'office'", 'name');
|
||||||
|
|
||||||
|
ok((not defined $val or not defined $val->{'name'}),
|
||||||
|
"addPostalAddress: type is not added when other input paramaters are invalid");
|
||||||
|
|
||||||
|
my $drapperPostalId;
|
||||||
|
|
||||||
|
lives_ok { $drapperPostalId = $sp->addPostalAddress($drapperPostalId,
|
||||||
|
"405 Madison Avenue\nNew York, NY 10000\nUSA", 'office'); }
|
||||||
|
"addPostalAddress: addPostalAddress of a valid formatted_address works.";
|
||||||
|
ok((looks_like_number($drapperPostalId) and $drapperPostalId > 0), "addPostalAddress: id returned is sane.");
|
||||||
|
|
||||||
=item addRequestType/getRequestType
|
=item addRequestType/getRequestType
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
Loading…
Reference in a new issue