From c6a202bdab7a4cf2b3d58bb0e75df8f39e4619ac Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 12 Apr 2017 11:06:43 -0300 Subject: [PATCH] Bug 18420: Fix Passwordrecovery.t when no patron category 'S' exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No need to create Staff users here. Test plan: prove t/db_dependent/Passwordrecovery.t should return green, even if no categories.categorycode 'S' exists Signed-off-by: Marc VĂ©ron --- t/db_dependent/Passwordrecovery.t | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/t/db_dependent/Passwordrecovery.t b/t/db_dependent/Passwordrecovery.t index f8ae6aa..4d4781b 100755 --- a/t/db_dependent/Passwordrecovery.t +++ b/t/db_dependent/Passwordrecovery.t @@ -21,6 +21,7 @@ use C4::Context; use C4::Letters; use Koha::Database; use Koha::Patrons; +use t::lib::TestBuilder; use Test::More tests => 18; @@ -35,7 +36,7 @@ $dbh->{RaiseError} = 1; # # Start with fresh data # - +my $builder = t::lib::TestBuilder->new; my $borrowernumber1 = '2000000000'; my $borrowernumber2 = '2000000001'; my $borrowernumber3 = '2000000002'; @@ -49,7 +50,7 @@ my $uuid1 = "ABCD1234"; my $uuid2 = "WXYZ0987"; my $uuid3 = "LMNO4561"; -my $categorycode = 'S'; # staff +my $patron_category = $builder->build({ source => 'Category' }); my $branch = $schema->resultset('Branch')->first(); # legit branch from your db $schema->resultset('BorrowerPasswordRecovery')->delete_all(); @@ -62,7 +63,7 @@ $schema->resultset('Borrower')->create( city => '', userid => $userid1, email => $email1, - categorycode => $categorycode, + categorycode => $patron_category->{categorycode}, branchcode => $branch, } ); @@ -74,7 +75,7 @@ $schema->resultset('Borrower')->create( city => '', userid => $userid2, email => $email2, - categorycode => $categorycode, + categorycode => $patron_category->{categorycode}, branchcode => $branch, } ); @@ -86,7 +87,7 @@ $schema->resultset('Borrower')->create( city => '', userid => $userid3, email => $email3, - categorycode => $categorycode, + categorycode => $patron_category->{categorycode}, branchcode => $branch, } ); -- 2.1.4