fulfillRequest: allow requestTypeId per getRequest
getRequest() now allows requestTypeId, so fulfillRequest() can as well. Add tests for that, and don't die if requestType isn't given.
This commit is contained in:
parent
d6ce8225d9
commit
9c8db6b84f
2 changed files with 13 additions and 2 deletions
|
@ -850,7 +850,8 @@ sub fulfillRequest($$) {
|
|||
die "fulfillRequest: donorId, \"$donorId\" not found in supporter database"
|
||||
unless $self->_verifyId($donorId);
|
||||
die "fulfillRequest: undefined who" unless defined $params->{who};
|
||||
die "fulfillRequest: undefined requestType" unless defined $params->{requestType};
|
||||
die "fulfillRequest: both requestType and requestTypeId undefined"
|
||||
unless defined $params->{requestType} or defined $params->{requestTypeId};
|
||||
|
||||
my $req = $self->getRequest($params);
|
||||
return undef if not defined $req;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Test::More tests => 158;
|
||||
use Test::More tests => 160;
|
||||
use Test::Exception;
|
||||
|
||||
use Scalar::Util qw(looks_like_number reftype);
|
||||
|
@ -360,6 +360,16 @@ lives_ok { $lookedUpFulfillmentId = $sp->fulfillRequest( { donorId => $drapperId
|
|||
is($lookedUpFulfillmentId, $fulfillRequestId,
|
||||
"fulfillRequest: ... but, rather, returns the same value from the previous fulfillRequest() call.");
|
||||
|
||||
|
||||
my $newFRID;
|
||||
lives_ok { $newFRID = $sp->fulfillRequest( { donorId => $drapperId,
|
||||
requestTypeId => $tShirt0RequestTypeId, who => 'john',
|
||||
how => "mailed" }); }
|
||||
"fulfillRequest: succeeds for existing request, using requestTypeId";
|
||||
|
||||
ok( (defined $newFRID and looks_like_number($newFRID) and $newFRID > 0 and ($newFRID != $fulfillRequestId)),
|
||||
"fulfillRequest: id returned on successful fulfillRequest() is a number and is not the one returned by previous");
|
||||
|
||||
=item getRequest
|
||||
|
||||
=cut
|
||||
|
|
Loading…
Reference in a new issue