Bugzilla – Attachment 83161 Details for
Bug 21798
We need t::lib::TestBuilder::build_sample_biblio
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21798: Replace 2 more occurrences
Bug-21798-Replace-2-more-occurrences.patch (text/plain), 12.89 KB, created by
Marcel de Rooy
on 2018-12-13 13:06:27 UTC
(
hide
)
Description:
Bug 21798: Replace 2 more occurrences
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2018-12-13 13:06:27 UTC
Size:
12.89 KB
patch
obsolete
>From 2a9b62a1b424960137ce320ebb4550f0ffc05370 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 6 Dec 2018 18:00:09 -0300 >Subject: [PATCH] Bug 21798: Replace 2 more occurrences >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/Labels/t_Label.t | 17 +--------- > t/db_dependent/Reserves.t | 72 ++++++++++++++--------------------------- > 2 files changed, 26 insertions(+), 63 deletions(-) > >diff --git a/t/db_dependent/Labels/t_Label.t b/t/db_dependent/Labels/t_Label.t >index 2d44b44..e61e593 100644 >--- a/t/db_dependent/Labels/t_Label.t >+++ b/t/db_dependent/Labels/t_Label.t >@@ -58,22 +58,7 @@ my $itemtype = > > C4::Context->set_userenv( undef, undef, undef, undef, undef, undef, $branch_1 ); > >-# Create a helper biblio >-my $bib = MARC::Record->new(); >-my $title = 'Silence in the library'; >-if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) { >- $bib->append_fields( >- MARC::Field->new( '600', q{}, '1', a => 'Moffat, Steven' ), >- MARC::Field->new( '200', q{}, q{}, a => $title ), >- ); >-} >-else { >- $bib->append_fields( >- MARC::Field->new( '100', q{}, q{}, a => 'Moffat, Steven' ), >- MARC::Field->new( '245', q{}, q{}, a => $title ), >- ); >-} >-my ($bibnum) = AddBiblio( $bib, $frameworkcode ); >+my $bibnum = $builder->gimme_a_biblio({ frameworkcode => $frameworkcode })->biblionumber; > > # Create a helper item instance for testing > my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem( >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index 9fe293d..ea335ae 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -81,22 +81,7 @@ C4::Context->set_userenv( > undef, undef, undef, undef, undef, undef, $branch_1 > ); > >-# Create a helper biblio >-my $bib = MARC::Record->new(); >-my $title = 'Silence in the library'; >-if( C4::Context->preference('marcflavour') eq 'UNIMARC' ) { >- $bib->append_fields( >- MARC::Field->new('600', '', '1', a => 'Moffat, Steven'), >- MARC::Field->new('200', '', '', a => $title), >- ); >-} >-else { >- $bib->append_fields( >- MARC::Field->new('100', '', '', a => 'Moffat, Steven'), >- MARC::Field->new('245', '', '', a => $title), >- ); >-} >-my ( $bibnum ) = AddBiblio($bib, $frameworkcode); >+my $bibnum = $builder->gimme_a_biblio({frameworkcode => $frameworkcode})->biblionumber; > > # Create a helper item instance for testing > my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem( >@@ -137,7 +122,7 @@ my $branchcode = Koha::Libraries->search->next->branchcode; > > AddReserve($branchcode, $borrowernumber, $biblionumber, > $bibitems, $priority, $resdate, $expdate, $notes, >- $title, $checkitem, $found); >+ 'a title', $checkitem, $found); > > my ($status, $reserve, $all_reserves) = CheckReserves($itemnumber, $barcode); > >@@ -229,15 +214,8 @@ $dbh->do( > $branch_2, 10, 2, 'homebranch', > ); > >-# helper biblio for the bug 10272 regression test >-my $bib2 = MARC::Record->new(); >-$bib2->append_fields( >- MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'), >- MARC::Field->new('245', ' ', ' ', a => $title), >-); >+my $bibnum2 = $builder->gimme_a_biblio({frameworkcode => $frameworkcode})->biblionumber; > >-# create one item belonging to FPL and one belonging to CPL >-my ( $bibnum2 ) = AddBiblio($bib, $frameworkcode); > my ($itemnum_cpl, $itemnum_fpl); > ( undef, undef, $itemnum_cpl ) = AddItem( > { homebranch => $branch_1, >@@ -262,13 +240,13 @@ my ($itemnum_cpl, $itemnum_fpl); > $dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2)); > AddReserve($branch_3, $requesters{$branch_3}, $bibnum2, > $bibitems, 1, $resdate, $expdate, $notes, >- $title, $checkitem, $found); >+ 'a title', $checkitem, $found); > AddReserve($branch_2, $requesters{$branch_2}, $bibnum2, > $bibitems, 2, $resdate, $expdate, $notes, >- $title, $checkitem, $found); >+ 'a title', $checkitem, $found); > AddReserve($branch_1, $requesters{$branch_1}, $bibnum2, > $bibitems, 3, $resdate, $expdate, $notes, >- $title, $checkitem, $found); >+ 'a title', $checkitem, $found); > ModReserveAffect($itemnum_cpl, $requesters{$branch_3}, 0); > > # Now it should have different priorities. >@@ -286,13 +264,13 @@ is( $reserves[0]->borrowernumber(), $requesters{$branch_3}, 'GetWaiting got the > $dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2)); > AddReserve($branch_3, $requesters{$branch_3}, $bibnum2, > $bibitems, 1, $resdate, $expdate, $notes, >- $title, $checkitem, $found); >+ 'a title', $checkitem, $found); > AddReserve($branch_2, $requesters{$branch_2}, $bibnum2, > $bibitems, 2, $resdate, $expdate, $notes, >- $title, $checkitem, $found); >+ 'a title', $checkitem, $found); > AddReserve($branch_1, $requesters{$branch_1}, $bibnum2, > $bibitems, 3, $resdate, $expdate, $notes, >- $title, $checkitem, $found); >+ 'a title', $checkitem, $found); > > # Ensure that the item's home library controls hold policy lookup > t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'ItemHomeLibrary' ); >@@ -331,7 +309,7 @@ $expdate= undef; #no expdate > $dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum)); > AddReserve($branch_1, $requesters{$branch_1}, $bibnum, > $bibitems, 1, $resdate, $expdate, $notes, >- $title, $checkitem, $found); >+ 'a title', $checkitem, $found); > ($status)=CheckReserves($itemnumber,undef,undef); > is( $status, 'Reserved', 'CheckReserves returns reserve without lookahead'); > ($status)=CheckReserves($itemnumber,undef,7); >@@ -346,7 +324,7 @@ $resdate=output_pref($resdate); > $expdate= undef; #no expdate > AddReserve($branch_1, $requesters{$branch_1}, $bibnum, > $bibitems, 1, $resdate, $expdate, $notes, >- $title, $checkitem, $found); >+ 'a title', $checkitem, $found); > ($status)=CheckReserves($itemnumber,undef,undef); > is( $status, '', 'CheckReserves returns no future reserve without lookahead'); > >@@ -403,7 +381,7 @@ $resdate->add_duration(DateTime::Duration->new(days => 2)); > $resdate=output_pref($resdate); > AddReserve($branch_1, $requesters{$branch_1}, $bibnum, > $bibitems, 1, $resdate, $expdate, $notes, >- $title, $checkitem, $found); >+ 'a title', $checkitem, $found); > my $item = Koha::Items->find( $itemnumber ); > $holds = $item->current_holds; > my $dtf = Koha::Database->new->schema->storage->datetime_parser; >@@ -413,7 +391,7 @@ is( $future_holds->count, 0, 'current_holds does not return a future next availa > $dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum)); > AddReserve($branch_1, $requesters{$branch_1}, $bibnum, > $bibitems, 1, $resdate, $expdate, $notes, >- $title, $itemnumber, $found); #item level hold >+ 'a title', $itemnumber, $found); #item level hold > $future_holds = $holds->search({ reservedate => { '>' => $dtf->format_date( dt_from_string ) } } ); > is( $future_holds->count, 0, 'current_holds does not return a future item level hold' ); > # 9788c: current_holds returns future wait (confirmed future hold) >@@ -429,7 +407,7 @@ is($p, 4, 'CalculatePriority should now return priority 4'); > $resdate=undef; > AddReserve($branch_1, $requesters{'CPL2'}, $bibnum2, > $bibitems, $p, $resdate, $expdate, $notes, >- $title, $checkitem, $found); >+ 'a title', $checkitem, $found); > $p = C4::Reserves::CalculatePriority($bibnum2); > is($p, 5, 'CalculatePriority should now return priority 5'); > #some tests on bibnum >@@ -439,7 +417,7 @@ is($p, 1, 'CalculatePriority should now return priority 1'); > #add a new reserve and confirm it to waiting > AddReserve($branch_1, $requesters{$branch_1}, $bibnum, > $bibitems, $p, $resdate, $expdate, $notes, >- $title, $itemnumber, $found); >+ 'a title', $itemnumber, $found); > $p = C4::Reserves::CalculatePriority($bibnum); > is($p, 2, 'CalculatePriority should now return priority 2'); > ModReserveAffect( $itemnumber, $requesters{$branch_1} , 0); >@@ -448,7 +426,7 @@ is($p, 1, 'CalculatePriority should now return priority 1'); > #add another biblio hold, no resdate > AddReserve($branch_1, $requesters{'CPL2'}, $bibnum, > $bibitems, $p, $resdate, $expdate, $notes, >- $title, $checkitem, $found); >+ 'a title', $checkitem, $found); > $p = C4::Reserves::CalculatePriority($bibnum); > is($p, 2, 'CalculatePriority should now return priority 2'); > #add another future hold >@@ -457,7 +435,7 @@ $resdate= dt_from_string(); > $resdate->add_duration(DateTime::Duration->new(days => 1)); > AddReserve($branch_1, $requesters{'CPL3'}, $bibnum, > $bibitems, $p, output_pref($resdate), $expdate, $notes, >- $title, $checkitem, $found); >+ 'a title', $checkitem, $found); > $p = C4::Reserves::CalculatePriority($bibnum); > is($p, 2, 'CalculatePriority should now still return priority 2'); > #calc priority with future resdate >@@ -469,7 +447,7 @@ is($p, 3, 'CalculatePriority should now return priority 3'); > $dbh->do('DELETE FROM reserves', undef, ($bibnum)); > AddReserve($branch_1, $requesters{$branch_1}, $item_bibnum, > $bibitems, 1, undef, $expdate, $notes, >- $title, $checkitem, ''); >+ 'a title', $checkitem, ''); > my (undef, $canres, undef) = CheckReserves($itemnumber); > > is( CanReserveBeCanceledFromOpac(), undef, >@@ -499,7 +477,7 @@ is($cancancel, 0, 'Reserve in transfer status cant be canceled'); > $dbh->do('DELETE FROM reserves', undef, ($bibnum)); > AddReserve($branch_1, $requesters{$branch_1}, $item_bibnum, > $bibitems, 1, undef, $expdate, $notes, >- $title, $checkitem, ''); >+ 'a title', $checkitem, ''); > (undef, $canres, undef) = CheckReserves($itemnumber); > > ModReserveAffect($itemnumber, $requesters{$branch_1}, 0); >@@ -549,13 +527,13 @@ $dbh->do('DELETE FROM reserves', undef, ($bibnum)); > t::lib::Mocks::mock_preference('ConfirmFutureHolds', 0); > t::lib::Mocks::mock_preference('AllowHoldDateInFuture', 1); > AddReserve($branch_1, $borrowernumber, $item_bibnum, >- $bibitems, 1, undef, $expdate, $notes, $title, $checkitem, ''); >+ $bibitems, 1, undef, $expdate, $notes, 'a title', $checkitem, ''); > MoveReserve( $itemnumber, $borrowernumber ); > ($status)=CheckReserves( $itemnumber ); > is( $status, '', 'MoveReserve filled hold'); > # hold from A waiting, today, no fut holds: MoveReserve should fill it > AddReserve($branch_1, $borrowernumber, $item_bibnum, >- $bibitems, 1, undef, $expdate, $notes, $title, $checkitem, 'W'); >+ $bibitems, 1, undef, $expdate, $notes, 'a title', $checkitem, 'W'); > MoveReserve( $itemnumber, $borrowernumber ); > ($status)=CheckReserves( $itemnumber ); > is( $status, '', 'MoveReserve filled waiting hold'); >@@ -564,7 +542,7 @@ $resdate= dt_from_string(); > $resdate->add_duration(DateTime::Duration->new(days => 1)); > $resdate=output_pref($resdate); > AddReserve($branch_1, $borrowernumber, $item_bibnum, >- $bibitems, 1, $resdate, $expdate, $notes, $title, $checkitem, ''); >+ $bibitems, 1, $resdate, $expdate, $notes, 'a title', $checkitem, ''); > MoveReserve( $itemnumber, $borrowernumber ); > ($status)=CheckReserves( $itemnumber, undef, 1 ); > is( $status, 'Reserved', 'MoveReserve did not fill future hold'); >@@ -572,13 +550,13 @@ $dbh->do('DELETE FROM reserves', undef, ($bibnum)); > # hold from A pos 1, tomorrow, fut holds=2: MoveReserve should fill it > t::lib::Mocks::mock_preference('ConfirmFutureHolds', 2); > AddReserve($branch_1, $borrowernumber, $item_bibnum, >- $bibitems, 1, $resdate, $expdate, $notes, $title, $checkitem, ''); >+ $bibitems, 1, $resdate, $expdate, $notes, 'a title', $checkitem, ''); > MoveReserve( $itemnumber, $borrowernumber ); > ($status)=CheckReserves( $itemnumber, undef, 2 ); > is( $status, '', 'MoveReserve filled future hold now'); > # hold from A waiting, tomorrow, fut holds=2: MoveReserve should fill it > AddReserve($branch_1, $borrowernumber, $item_bibnum, >- $bibitems, 1, $resdate, $expdate, $notes, $title, $checkitem, 'W'); >+ $bibitems, 1, $resdate, $expdate, $notes, 'a title', $checkitem, 'W'); > MoveReserve( $itemnumber, $borrowernumber ); > ($status)=CheckReserves( $itemnumber, undef, 2 ); > is( $status, '', 'MoveReserve filled future waiting hold now'); >@@ -587,7 +565,7 @@ $resdate= dt_from_string(); > $resdate->add_duration(DateTime::Duration->new(days => 3)); > $resdate=output_pref($resdate); > AddReserve($branch_1, $borrowernumber, $item_bibnum, >- $bibitems, 1, $resdate, $expdate, $notes, $title, $checkitem, ''); >+ $bibitems, 1, $resdate, $expdate, $notes, 'a title', $checkitem, ''); > MoveReserve( $itemnumber, $borrowernumber ); > ($status)=CheckReserves( $itemnumber, undef, 3 ); > is( $status, 'Reserved', 'MoveReserve did not fill future hold of 3 days'); >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21798
:
82116
|
82276
|
82277
|
82278
|
82943
|
83136
|
83137
|
83149
|
83150
|
83151
|
83152
|
83153
|
83154
|
83156
|
83157
|
83158
|
83159
|
83160
|
83161
|
83162
|
83163
|
84490
|
84491
|
84492
|
84493
|
84494
|
84495
|
84496