From e80eb34df52070b9c536ff5cb53f9635cb8a8859 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Tue, 2 Jul 2019 05:01:55 +0000 Subject: [PATCH] Bug 23199: Added tests for Koha::Patron Signed-off-by: Mark Tompsett --- t/db_dependent/Koha/Patrons.t | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t index a73b8e819d..b0e2bd8763 100644 --- a/t/db_dependent/Koha/Patrons.t +++ b/t/db_dependent/Koha/Patrons.t @@ -1526,7 +1526,7 @@ subtest 'Test Koha::Patrons::merge' => sub { }; subtest '->store' => sub { - plan tests => 3; + plan tests => 5; my $schema = Koha::Database->new->schema; $schema->storage->txn_begin; @@ -1550,6 +1550,17 @@ subtest '->store' => sub { $patron_1->surname('xxx')->store; is( $patron_1->password, $digest, 'Password should not have changed on ->store'); + # Test uppercasesurname + t::lib::Mocks::mock_preference( 'uppercasesurname', 1 ); + my $surname = lc $patron_1->surname; + $patron_1->surname($surname)->store; + isnt( $patron_1->surname, $surname, + 'Surname converts to uppercase on store.'); + t::lib::Mocks::mock_preference( 'uppercasesurname', 0 ); + $patron_1->surname($surname)->store; + is( $patron_1->surname, $surname, + 'Surname remains unchanged on store.'); + $schema->storage->dbh->{PrintError} = $print_error; $schema->storage->txn_rollback; }; -- 2.11.0