From 10eda8f6c60cf9f5540d9c533cf337d25d1df434 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Mon, 16 Jan 2017 21:54:29 -0500 Subject: [PATCH] Bug 17917: Fix Jenkins for t/db_dependent/Reserves.t TEST PLAN --------- 1) prove -v t/db_dependent/Reserves.t -- fails 2) apply this patch 3) prove -v t/db_dependent/Reserves.t -- succeeds 4) run koha qa test tools --- t/db_dependent/Reserves.t | 61 +++++++++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 20 deletions(-) diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t index 37d90d9..c4d0f16 100755 --- a/t/db_dependent/Reserves.t +++ b/t/db_dependent/Reserves.t @@ -106,9 +106,14 @@ my %data = ( surname => 'my surname', categorycode => $category_1, branchcode => $branch_1, + dateofbirth => undef, ); Koha::Patron::Categories->find($category_1)->set({ enrolmentfee => 0})->store; -my $borrowernumber = AddMember(%data); +my $patron = $builder->build({ + source => 'Borrower', + value => \%data, +}); +my $borrowernumber = $patron->{borrowernumber}; my $borrower = GetMember( borrowernumber => $borrowernumber ); my $biblionumber = $bibnum; my $barcode = $testbarcode; @@ -160,28 +165,44 @@ t::lib::Mocks::mock_preference( 'ReservesControlBranch', $ReservesControlBranch ### Regression test for bug 10272 ### my %requesters = (); -$requesters{$branch_1} = AddMember( - branchcode => $branch_1, - categorycode => $category_2, - surname => "borrower from $branch_1", -); -for my $i ( 2 .. 5 ) { - $requesters{"CPL$i"} = AddMember( +my $patron_branch1 = $builder->build({ + source => 'Borrower', + value => { branchcode => $branch_1, categorycode => $category_2, - surname => "borrower $i from $branch_1", - ); + surname => "borrower from $branch_1", + }, +}); +$requesters{$branch_1} = $patron_branch1->{borrowernumber}; +for my $i ( 2 .. 5 ) { + my $patron_cpl = $builder->build({ + source => 'Borrower', + value => { + branchcode => $branch_1, + categorycode => $category_2, + surname => "borrower $i from $branch_1", + }, + }); + $requesters{"CPL$i"} = $patron_cpl; } -$requesters{$branch_2} = AddMember( - branchcode => $branch_2, - categorycode => $category_2, - surname => "borrower from $branch_2", -); -$requesters{$branch_3} = AddMember( - branchcode => $branch_3, - categorycode => $category_2, - surname => "borrower from $branch_3", -); +my $patron_branch2 = $builder->build({ + source => 'Borrower', + value => { + branchcode => $branch_2, + categorycode => $category_2, + surname => "borrower from $branch_2", + } +}); +$requesters{$branch_2} = $patron_branch2->{borrowernumber}; +my $patron_branch3 = $builder->build({ + source => 'Borrower', + value => { + branchcode => $branch_3, + categorycode => $category_2, + surname => "borrower from $branch_3", + }, +}); +$requesters{$branch_3} = $patron_branch3->{borrowernumber}; # Configure rules so that $branch_1 allows only $branch_1 patrons # to request its items, while $branch_2 will allow its items -- 2.1.4