Bug 22343: (follow-up) Make sure no invalid address is used in tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Tomas Cohen Arazi 2020-10-02 16:17:40 -03:00 committed by Jonathan Druart
parent c54da79431
commit 04f2ecb56c
1 changed files with 13 additions and 6 deletions

View File

@ -23,25 +23,30 @@ use C4::Letters;
use Koha::Database;
use Koha::DateUtils;
use Koha::Patrons;
use t::lib::TestBuilder;
use t::lib::Mocks;
use Test::More tests => 22;
use Test::MockModule;
use Test::Warn;
use Carp;
my %mail;
my $module = Test::MockModule->new('Mail::Sendmail');
$module->mock(
'sendmail',
my ( $email_object, $sendmail_params );
my $email_sender_module = Test::MockModule->new('Email::Stuffer');
$email_sender_module->mock(
'send_or_die',
sub {
carp 'Fake sendmail';
%mail = @_;
( $email_object, $sendmail_params ) = @_;
warn 'Fake sendmail';
}
);
use_ok('Koha::Patron::Password::Recovery');
t::lib::Mocks::mock_preference('KohaAdminEmailAddress', 'test@koha-community.org');
my $schema = Koha::Database->new()->schema();
$schema->storage->txn_begin();
@ -66,6 +71,8 @@ my $patron_category = $builder->build({ source => 'Category' });
my $branch = $builder->build({
source => 'Branch',
value => {
branchemail => undef,
branchreplyto => undef,
branchreturnpath => $email1,
},
});