_lookupDeliveryError: begun

Verify beginnings of implementation
This commit is contained in:
Bradley M. Kuhn 2017-12-26 12:32:15 -08:00
parent 9ffd4d4e88
commit a82ebfb0a9
2 changed files with 33 additions and 0 deletions

View file

@ -2039,6 +2039,28 @@ sub _lookupRequestTypeById($$) {
}
######################################################################
=item _lookupDeliveryError()
Parameters:
=over
=item $self: current object.
=item $errorName: A scalar string argument that is the error
=back
Returns: undef if the error code does not exist in the delivery_error table,
otherwise returns the id for the entry in the delivery_table
=cut
sub _lookupDeliveryError($$) {
}
######################################################################
=item _lookupEmailAddress()
Parameters:

View file

@ -376,9 +376,20 @@ ok($same == $paypalPayerAddressType, "addAddressType: lookup returns same as the
# Add an "undeliverable" delivery_error type
$val = 1;
lives_ok { $val = $sp->_lookupDeliveryError("undeliverable"); },
"_lookupDeliveryError: succeeds for unknown error ...";
is($val, undef, "_lookupDeliveryError: ... but returns undef");
my $sth = $sp->dbh->prepare("INSERT INTO delivery_error(error) VALUES(?)"); $sth->execute("undeliverable"); $sth->finish;
my $undeliverableId = $sp->dbh->last_insert_id("","","delivery_error","");
$val = -1;
lives_ok { $val = $sp->_lookupDeliveryError("undeliverable"); },
"_lookupDeliveryError: succeeds for known error ...";
is($val, $undeliverable, "_lookupDeliveryError: ... and returns proper id number");
dies_ok { $sp->addEmailError(undef); }
"addEmailError: undef argument dies.";