Bug 18570: Tests to prove if email send was attempted
authorMark Tompsett <mtompset@hotmail.com>
Wed, 7 Mar 2018 23:59:54 +0000 (23:59 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 19 Mar 2018 16:55:37 +0000 (13:55 -0300)
kshell
prove -v t/db_dependent/Passwordrecovery.t

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

t/db_dependent/Passwordrecovery.t

index f11893f..dafe6b1 100755 (executable)
@@ -23,7 +23,7 @@ use Koha::Database;
 use Koha::Patrons;
 use t::lib::TestBuilder;
 
-use Test::More tests => 18;
+use Test::More tests => 20;
 
 use_ok('Koha::Patron::Password::Recovery');
 
@@ -192,5 +192,10 @@ $letters = C4::Letters::GetQueuedMessages( { borrowernumber => $borrowernumber1,
 ok( $tempuuid1 ne $tempuuid2, "[SendPasswordRecoveryEmail] UPDATE == ON changes uuid in the database and updates the expirydate");
 ok( scalar @$letters == 2, "[SendPasswordRecoveryEmail] UPDATE == ON sends a new letter with updated uuid");
 
+foreach my $letter (@$letters) {
+    ok( $letter->{status} eq 'failed',
+        'Test SendPasswordRecoverEmail failed due to TestBuilder Sender not being a valid email address as expected.' );
+}
+
 $schema->storage->txn_rollback();