From 9e2359ed727efe753cdf6a8b680707943e25b9d0 Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Fri, 11 Dec 2015 18:23:24 -0800 Subject: [PATCH] Test to verify addEmailAddress returns a valid id. --- Supporters/lib/Supporters.pm | 2 ++ Supporters/t/Supporters.t | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Supporters/lib/Supporters.pm b/Supporters/lib/Supporters.pm index 0fbcc62..def7e84 100644 --- a/Supporters/lib/Supporters.pm +++ b/Supporters/lib/Supporters.pm @@ -168,6 +168,8 @@ Arguments: =back +Returns the id value of the email_address entry. + =cut sub addEmailAddress($$$$) { diff --git a/Supporters/t/Supporters.t b/Supporters/t/Supporters.t index 00e8801..cab737a 100644 --- a/Supporters/t/Supporters.t +++ b/Supporters/t/Supporters.t @@ -5,7 +5,7 @@ use strict; use warnings; -use Test::More tests => 21; +use Test::More tests => 23; use Test::Exception; use Scalar::Util qw(looks_like_number); @@ -79,8 +79,11 @@ dies_ok { $sp->addEmailAddress(undef, 'drapper@example.org', 'paypal'); } dies_ok { $sp->addEmailAddress("String", 'drapper@example.org', 'paypal'); } "addEmailAddress: dies for non-numeric id"; -ok($sp->addEmailAddress($drapperId, 'drapper@example.org', 'work'), - "addEmailAddress: simple add test"); +my $drapperEmailId; + +lives_ok { $drapperEmailId = $sp->addEmailAddress($drapperId, 'drapper@example.org', 'work') } + "addEmailAdress: inserting a valid email address works"; +ok((looks_like_number($drapperEmailId) and $drapperEmailId > 0), "addEmailAddress: id returned is sane."); =item addAddressType