View | Details | Raw Unified | Return to bug 29046
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Patron.t (-1 / +27 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 21;
22
use Test::More tests => 23;
23
use Test::Exception;
23
use Test::Exception;
24
use Test::Warn;
24
use Test::Warn;
25
25
Lines 1351-1356 subtest 'notify_library_of_registration()' => sub { Link Here
1351
    $schema->storage->txn_rollback;
1351
    $schema->storage->txn_rollback;
1352
};
1352
};
1353
1353
1354
subtest 'notice_email_address' => sub {
1355
    plan tests => 2;
1356
1357
    my $patron = $builder->build_object({ class => 'Koha::Patrons' });
1358
1359
    t::lib::Mocks::mock_preference( 'EmailFieldPrecedence', 'email|emailpro' );
1360
    t::lib::Mocks::mock_preference( 'EmailFieldPrimary', 'OFF' );
1361
    is ($patron->notice_email_address, $patron->email, "Koha::Patron->notice_email_address returns correct value when EmailFieldPrimary is off");
1362
1363
    t::lib::Mocks::mock_preference( 'EmailFieldPrimary', 'emailpro' );
1364
    is ($patron->notice_email_address, $patron->emailpro, "Koha::Patron->notice_email_address returns correct value when EmailFieldPrimary is emailpro");
1365
1366
    $patron->delete;
1367
};
1368
1369
subtest 'first_valid_email_address' => sub {
1370
    plan tests => 1;
1371
1372
    my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { emailpro => ''}});
1373
1374
    t::lib::Mocks::mock_preference( 'EmailFieldPrecedence', 'emailpro|email' );
1375
    is ($patron->first_valid_email_address, $patron->email, "Koha::Patron->first_valid_email_address returns correct value when EmailFieldPrecedence is 'emailpro|email' and emailpro is empty");
1376
1377
    $patron->delete;
1378
};
1379
1354
subtest 'get_savings tests' => sub {
1380
subtest 'get_savings tests' => sub {
1355
1381
1356
    plan tests => 4;
1382
    plan tests => 4;
(-)a/t/db_dependent/Koha/Patrons.t (-16 / +1 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 44;
22
use Test::More tests => 43;
23
use Test::Warn;
23
use Test::Warn;
24
use Test::Exception;
24
use Test::Exception;
25
use Test::MockModule;
25
use Test::MockModule;
Lines 1061-1080 subtest 'holds and old_holds' => sub { Link Here
1061
    $patron->delete;
1061
    $patron->delete;
1062
};
1062
};
1063
1063
1064
subtest 'notice_email_address' => sub {
1065
    plan tests => 2;
1066
1067
    my $patron = $builder->build_object({ class => 'Koha::Patrons' });
1068
1069
    t::lib::Mocks::mock_preference( 'EmailFieldPrimary', 'OFF' );
1070
    is ($patron->notice_email_address, $patron->email, "Koha::Patron->notice_email_address returns correct value when EmailFieldPrimary is off");
1071
1072
    t::lib::Mocks::mock_preference( 'EmailFieldPrimary', 'emailpro' );
1073
    is ($patron->notice_email_address, $patron->emailpro, "Koha::Patron->notice_email_address returns correct value when EmailFieldPrimary is emailpro");
1074
1075
    $patron->delete;
1076
};
1077
1078
subtest 'search_patrons_to_anonymise' => sub {
1064
subtest 'search_patrons_to_anonymise' => sub {
1079
1065
1080
    plan tests => 5;
1066
    plan tests => 5;
1081
- 

Return to bug 29046