From 9c2086eaa8617562f4141e642697c6bef6c2ed51 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 11 Apr 2017 07:48:54 -0300 Subject: [PATCH] Bug 18420: Do not use 'S' as patron category code in other tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test plan: prove all these tests, they must all pass Signed-off-by: Marc VĂ©ron --- t/db_dependent/Acquisition/OrderUsers.t | 3 ++- t/db_dependent/Circulation.t | 27 +++++++++++----------- t/db_dependent/Circulation/IsItemIssued.t | 3 ++- .../Circulation/IssuingRules/maxsuspensiondays.t | 3 ++- t/db_dependent/Holds/HoldFulfillmentPolicy.t | 1 - t/db_dependent/Holds/HoldItemtypeLimit.t | 2 +- t/db_dependent/Holds/LocalHoldsPriority.t | 3 ++- t/db_dependent/Holds/RevertWaitingStatus.t | 3 ++- t/db_dependent/Members/Attributes.t | 2 -- t/db_dependent/Patron/Borrower_Debarments.t | 3 ++- t/db_dependent/Patron/Borrower_Files.t | 3 ++- t/db_dependent/Serials_2.t | 3 ++- 12 files changed, 31 insertions(+), 25 deletions(-) diff --git a/t/db_dependent/Acquisition/OrderUsers.t b/t/db_dependent/Acquisition/OrderUsers.t index b63f5a2..f683339 100644 --- a/t/db_dependent/Acquisition/OrderUsers.t +++ b/t/db_dependent/Acquisition/OrderUsers.t @@ -17,6 +17,7 @@ my $builder = t::lib::TestBuilder->new; my $library = $builder->build({ source => "Branch", }); +my $patron_category = $builder->build({ source => 'Category' }); # Creating some orders my $bookseller = Koha::Acquisition::Bookseller->new( @@ -68,7 +69,7 @@ my $borrowernumber = C4::Members::AddMember( cardnumber => 'TESTCARD', firstname => 'TESTFN', surname => 'TESTSN', - categorycode => 'S', + categorycode => $patron_category->{categorycode}, branchcode => $library->{branchcode}, dateofbirth => '', dateexpiry => '9999-12-31', diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 17b2dbf..7f5813f 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -58,6 +58,7 @@ my $itemtype = $builder->build( value => { notforloan => undef, rentalcharge => 0 } } )->{itemtype}; +my $patron_category = $builder->build({ source => 'Category', value => { enrolmentfee => 0 } }); my $CircControl = C4::Context->preference('CircControl'); my $HomeOrHoldingBranch = C4::Context->preference('HomeOrHoldingBranch'); @@ -190,7 +191,7 @@ my $sth = C4::Context->dbh->prepare("SELECT COUNT(*) FROM accountlines WHERE amo $sth->execute(); my ( $original_count ) = $sth->fetchrow_array(); -C4::Context->dbh->do("INSERT INTO borrowers ( cardnumber, surname, firstname, categorycode, branchcode ) VALUES ( '99999999999', 'Hall', 'Kyle', 'S', ? )", undef, $library2->{branchcode} ); +C4::Context->dbh->do("INSERT INTO borrowers ( cardnumber, surname, firstname, categorycode, branchcode ) VALUES ( '99999999999', 'Hall', 'Kyle', ?, ? )", undef, $patron_category->{categorycode}, $library2->{branchcode} ); C4::Circulation::ProcessOfflinePayment({ cardnumber => '99999999999', amount => '123.45' }); @@ -260,28 +261,28 @@ C4::Context->dbh->do("DELETE FROM accountlines"); my %renewing_borrower_data = ( firstname => 'John', surname => 'Renewal', - categorycode => 'S', + categorycode => $patron_category->{categorycode}, branchcode => $branch, ); my %reserving_borrower_data = ( firstname => 'Katrin', surname => 'Reservation', - categorycode => 'S', + categorycode => $patron_category->{categorycode}, branchcode => $branch, ); my %hold_waiting_borrower_data = ( firstname => 'Kyle', surname => 'Reservation', - categorycode => 'S', + categorycode => $patron_category->{categorycode}, branchcode => $branch, ); my %restricted_borrower_data = ( firstname => 'Alice', surname => 'Reservation', - categorycode => 'S', + categorycode => $patron_category->{categorycode}, debarred => '3228-01-01', branchcode => $branch, ); @@ -761,7 +762,7 @@ C4::Context->dbh->do("DELETE FROM accountlines"); my %a_borrower_data = ( firstname => 'Fridolyn', surname => 'SOMERS', - categorycode => 'S', + categorycode => $patron_category->{categorycode}, branchcode => $branch, ); @@ -841,7 +842,7 @@ C4::Context->dbh->do("DELETE FROM accountlines"); my %a_borrower_data = ( firstname => 'Kyle', surname => 'Hall', - categorycode => 'S', + categorycode => $patron_category->{categorycode}, branchcode => $branch, ); @@ -907,13 +908,13 @@ C4::Context->dbh->do("DELETE FROM accountlines"); my $borrowernumber1 = AddMember( firstname => 'Kyle', surname => 'Hall', - categorycode => 'S', + categorycode => $patron_category->{categorycode}, branchcode => $library2->{branchcode}, ); my $borrowernumber2 = AddMember( firstname => 'Chelsea', surname => 'Hall', - categorycode => 'S', + categorycode => $patron_category->{categorycode}, branchcode => $library2->{branchcode}, ); @@ -984,7 +985,7 @@ C4::Context->dbh->do("DELETE FROM accountlines"); my $borrowernumber = AddMember( firstname => 'fn', surname => 'dn', - categorycode => 'S', + categorycode => $patron_category->{categorycode}, branchcode => $branch, ); @@ -1310,7 +1311,7 @@ subtest 'MultipleReserves' => sub { my %renewing_borrower_data = ( firstname => 'John', surname => 'Renewal', - categorycode => 'S', + categorycode => $patron_category->{categorycode}, branchcode => $branch, ); my $renewing_borrowernumber = AddMember(%renewing_borrower_data); @@ -1323,7 +1324,7 @@ subtest 'MultipleReserves' => sub { my %reserving_borrower_data1 = ( firstname => 'Katrin', surname => 'Reservation', - categorycode => 'S', + categorycode => $patron_category->{categorycode}, branchcode => $branch, ); my $reserving_borrowernumber1 = AddMember(%reserving_borrower_data1); @@ -1336,7 +1337,7 @@ subtest 'MultipleReserves' => sub { my %reserving_borrower_data2 = ( firstname => 'Kirk', surname => 'Reservation', - categorycode => 'S', + categorycode => $patron_category->{categorycode}, branchcode => $branch, ); my $reserving_borrowernumber2 = AddMember(%reserving_borrower_data2); diff --git a/t/db_dependent/Circulation/IsItemIssued.t b/t/db_dependent/Circulation/IsItemIssued.t index b63f66f..ac98edf 100644 --- a/t/db_dependent/Circulation/IsItemIssued.t +++ b/t/db_dependent/Circulation/IsItemIssued.t @@ -37,6 +37,7 @@ my $builder = t::lib::TestBuilder->new; my $library = $builder->build({ source => 'Branch' }); my $itemtype = $builder->build({ source => 'Itemtype' })->{itemtype}; +my $patron_category = $builder->build({ source => 'Category' }); C4::Context->_new_userenv('DUMMY SESSION'); C4::Context->set_userenv( @@ -50,7 +51,7 @@ C4::Context->set_userenv( my $borrowernumber = AddMember( firstname => 'my firstname', surname => 'my surname', - categorycode => 'S', + categorycode => $patron_category->{categorycode}, branchcode => $library->{branchcode}, ); diff --git a/t/db_dependent/Circulation/IssuingRules/maxsuspensiondays.t b/t/db_dependent/Circulation/IssuingRules/maxsuspensiondays.t index 0ac8ad2..a5b6d6f 100644 --- a/t/db_dependent/Circulation/IssuingRules/maxsuspensiondays.t +++ b/t/db_dependent/Circulation/IssuingRules/maxsuspensiondays.t @@ -23,6 +23,7 @@ $dbh->{RaiseError} = 1; my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; my $itemtype = $builder->build({ source => 'Itemtype' })->{itemtype}; +my $patron_category = $builder->build({ source => 'Category' }); local $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /redefined/ }; my $userenv->{branch} = $branchcode; @@ -47,7 +48,7 @@ $builder->build( my $borrowernumber = AddMember( firstname => 'my firstname', surname => 'my surname', - categorycode => 'S', + categorycode => $patron_category->{categorycode}, branchcode => $branchcode, ); my $borrower = GetMember( borrowernumber => $borrowernumber ); diff --git a/t/db_dependent/Holds/HoldFulfillmentPolicy.t b/t/db_dependent/Holds/HoldFulfillmentPolicy.t index af30a0a..66abf5a 100755 --- a/t/db_dependent/Holds/HoldFulfillmentPolicy.t +++ b/t/db_dependent/Holds/HoldFulfillmentPolicy.t @@ -33,7 +33,6 @@ my $bib_title = "Test Title"; my $borrower = $builder->build({ source => 'Borrower', value => { - categorycode => 'S', branchcode => $library1->{branchcode}, } }); diff --git a/t/db_dependent/Holds/HoldItemtypeLimit.t b/t/db_dependent/Holds/HoldItemtypeLimit.t index a57f025..8fc8b3e 100644 --- a/t/db_dependent/Holds/HoldItemtypeLimit.t +++ b/t/db_dependent/Holds/HoldItemtypeLimit.t @@ -26,10 +26,10 @@ my $library = $builder->build({ my $bib_title = "Test Title"; + my $borrower = $builder->build({ source => 'Borrower', value => { - categorycode => 'S', branchcode => $library->{branchcode}, } }); diff --git a/t/db_dependent/Holds/LocalHoldsPriority.t b/t/db_dependent/Holds/LocalHoldsPriority.t index ef40686..8da4bef 100755 --- a/t/db_dependent/Holds/LocalHoldsPriority.t +++ b/t/db_dependent/Holds/LocalHoldsPriority.t @@ -53,13 +53,14 @@ my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem( my @branchcodes = ( $library1->{branchcode}, $library2->{branchcode}, $library3->{branchcode}, $library4->{branchcode}, $library3->{branchcode}, $library4->{branchcode} ); +my $patron_category = $builder->build({ source => 'Category' }); # Create some borrowers my @borrowernumbers; foreach ( 1 .. $borrowers_count ) { my $borrowernumber = AddMember( firstname => 'my firstname', surname => 'my surname ' . $_, - categorycode => 'S', + categorycode => $patron_category->{categorycode}, branchcode => $branchcodes[$_], ); push @borrowernumbers, $borrowernumber; diff --git a/t/db_dependent/Holds/RevertWaitingStatus.t b/t/db_dependent/Holds/RevertWaitingStatus.t index bf9d99a..146adb8 100755 --- a/t/db_dependent/Holds/RevertWaitingStatus.t +++ b/t/db_dependent/Holds/RevertWaitingStatus.t @@ -69,12 +69,13 @@ my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem( ); # Create some borrowers +my $patron_category = $builder->build({ source => 'Category' }); my @borrowernumbers; foreach my $i ( 1 .. $borrowers_count ) { my $borrowernumber = AddMember( firstname => 'my firstname', surname => 'my surname ' . $i, - categorycode => 'S', + categorycode => $patron_category->{categorycode}, branchcode => $branchcode, ); push @borrowernumbers, $borrowernumber; diff --git a/t/db_dependent/Members/Attributes.t b/t/db_dependent/Members/Attributes.t index e2ab1fe..918c9bf 100644 --- a/t/db_dependent/Members/Attributes.t +++ b/t/db_dependent/Members/Attributes.t @@ -48,7 +48,6 @@ my $patron = $builder->build( value => { firstname => 'my firstname', surname => 'my surname', - categorycode => 'S', branchcode => $library->{branchcode}, } } @@ -228,7 +227,6 @@ my $another_patron = $builder->build( value => { firstname => 'my another firstname', surname => 'my another surname', - categorycode => 'S', branchcode => $new_library->{branchcode}, } } diff --git a/t/db_dependent/Patron/Borrower_Debarments.t b/t/db_dependent/Patron/Borrower_Debarments.t index c4e52d3..2003b7e 100755 --- a/t/db_dependent/Patron/Borrower_Debarments.t +++ b/t/db_dependent/Patron/Borrower_Debarments.t @@ -22,10 +22,11 @@ my $library = $builder->build({ source => 'Branch', }); +my $patron_category = $builder->build({ source => 'Category' }); my $borrowernumber = AddMember( firstname => 'my firstname', surname => 'my surname', - categorycode => 'S', + categorycode => $patron_category->{categorycode}, branchcode => $library->{branchcode}, ); diff --git a/t/db_dependent/Patron/Borrower_Files.t b/t/db_dependent/Patron/Borrower_Files.t index 251f20a..da82a04 100644 --- a/t/db_dependent/Patron/Borrower_Files.t +++ b/t/db_dependent/Patron/Borrower_Files.t @@ -42,10 +42,11 @@ my $library = $builder->build({ source => 'Branch', }); +my $patron_category = $builder->build({ source => 'Category' }); my $borrowernumber = AddMember( firstname => 'my firstname', surname => 'my surname', - categorycode => 'S', + categorycode => $patron_category->{categorycode}, branchcode => $library->{branchcode}, ); diff --git a/t/db_dependent/Serials_2.t b/t/db_dependent/Serials_2.t index 202c641..b326ae6 100644 --- a/t/db_dependent/Serials_2.t +++ b/t/db_dependent/Serials_2.t @@ -27,6 +27,7 @@ my $library1 = $builder->build({ my $library2 = $builder->build({ source => 'Branch', }); +my $patron_category = $builder->build({ source => 'Category' }); my $dbh = C4::Context->dbh; $dbh->{RaiseError} = 1; @@ -81,7 +82,7 @@ my $userid = 'my_userid'; my $borrowernumber = C4::Members::AddMember( firstname => 'my fistname', surname => 'my surname', - categorycode => 'S', + categorycode => $patron_category->{categorycode}, branchcode => $my_branch, userid => $userid, ); -- 2.1.4