From 4652d311232451a069fee94972d54b0816cb0d6c Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 3 Nov 2023 10:48:39 +0000 Subject: [PATCH] Bug 34529: (QA follow-up) Tidy OfflineCirculation.t Signed-off-by: Kyle M Hall Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- .../Circulation/OfflineCirculation.t | 84 +++++++++++-------- 1 file changed, 47 insertions(+), 37 deletions(-) diff --git a/t/db_dependent/Circulation/OfflineCirculation.t b/t/db_dependent/Circulation/OfflineCirculation.t index 3ec4b81244..9aec60fb19 100755 --- a/t/db_dependent/Circulation/OfflineCirculation.t +++ b/t/db_dependent/Circulation/OfflineCirculation.t @@ -95,14 +95,12 @@ subtest "Bug 34529: Offline circulation should be able to accept userid as well "ProcessOfflineIssue succeeds with cardnumber" ); is( - ProcessOfflineIssue( - { cardnumber => $borrower1->{userid}, barcode => $item2->barcode } - ), + ProcessOfflineIssue( { cardnumber => $borrower1->{userid}, barcode => $item2->barcode } ), "Success.", "ProcessOfflineIssue succeeds with user id" ); - }; +}; subtest "Bug 30114 - Koha offline circulation will always cancel the next hold when issuing item to a patron" => sub { @@ -114,36 +112,45 @@ subtest "Bug 30114 - Koha offline circulation will always cancel the next hold w t::lib::Mocks::mock_preference( "item-level_itypes", 1 ); # Create a branch - $branch = $builder->build({ source => 'Branch' })->{ branchcode }; + $branch = $builder->build( { source => 'Branch' } )->{branchcode}; + # Create a borrower - my $borrower1 = $builder->build({ - source => 'Borrower', - value => { branchcode => $branch } - }); + my $borrower1 = $builder->build( + { + source => 'Borrower', + value => { branchcode => $branch } + } + ); - my $borrower2 = $builder->build({ - source => 'Borrower', - value => { branchcode => $branch } - }); + my $borrower2 = $builder->build( + { + source => 'Borrower', + value => { branchcode => $branch } + } + ); - my $borrower3 = $builder->build({ - source => 'Borrower', - value => { branchcode => $branch } - }); + my $borrower3 = $builder->build( + { + source => 'Borrower', + value => { branchcode => $branch } + } + ); # Look for the defined MARC field for biblio-level itemtype - my $rs = $schema->resultset('MarcSubfieldStructure')->search({ - frameworkcode => '', - kohafield => 'biblioitems.itemtype' - }); + my $rs = $schema->resultset('MarcSubfieldStructure')->search( + { + frameworkcode => '', + kohafield => 'biblioitems.itemtype' + } + ); my $tagfield = $rs->first->tagfield; my $tagsubfield = $rs->first->tagsubfield; # Create a biblio record with biblio-level itemtype my $record = MARC::Record->new(); my ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, '' ); - my $itype = $builder->build({ source => 'Itemtype' }); - my $item = $builder->build_sample_item( + my $itype = $builder->build( { source => 'Itemtype' } ); + my $item = $builder->build_sample_item( { biblionumber => $biblionumber, library => $branch, @@ -153,37 +160,40 @@ subtest "Bug 30114 - Koha offline circulation will always cancel the next hold w AddReserve( { - branchcode => $branch, - borrowernumber => $borrower1->{borrowernumber}, - biblionumber => $biblionumber, - priority => 1, - itemnumber => $item->id, + branchcode => $branch, + borrowernumber => $borrower1->{borrowernumber}, + biblionumber => $biblionumber, + priority => 1, + itemnumber => $item->id, } ); AddReserve( { - branchcode => $branch, - borrowernumber => $borrower2->{borrowernumber}, - biblionumber => $biblionumber, - priority => 2, - itemnumber => $item->id, + branchcode => $branch, + borrowernumber => $borrower2->{borrowernumber}, + biblionumber => $biblionumber, + priority => 2, + itemnumber => $item->id, } ); my $now = dt_from_string->truncate( to => 'minute' ); - AddOfflineOperation( $borrower3->{borrowernumber}, $borrower3->{branchcode}, $now, 'issue', $item->barcode, $borrower3->{cardnumber} ); + AddOfflineOperation( + $borrower3->{borrowernumber}, $borrower3->{branchcode}, $now, 'issue', $item->barcode, + $borrower3->{cardnumber} + ); my $offline_rs = Koha::Database->new()->schema()->resultset('PendingOfflineOperation')->search(); is( $offline_rs->count, 1, "Found one pending offline operation" ); - is( Koha::Holds->search({ biblionumber => $biblionumber })->count, 2, "Found two holds for the record" ); + is( Koha::Holds->search( { biblionumber => $biblionumber } )->count, 2, "Found two holds for the record" ); my $op = GetOfflineOperation( $offline_rs->next->id ); - my $ret = ProcessOfflineOperation( $op ); + my $ret = ProcessOfflineOperation($op); - is( Koha::Holds->search({ biblionumber => $biblionumber })->count, 2, "Still found two holds for the record" ); + is( Koha::Holds->search( { biblionumber => $biblionumber } )->count, 2, "Still found two holds for the record" ); }; $schema->storage->txn_rollback; -- 2.20.1