Browse Source

Bug 21798: replace gimme_a_biblio with build_sample_biblio

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
19.05.x
Jonathan Druart 4 years ago
committed by Nick Clemens
parent
commit
2b76548770
  1. 18
      t/db_dependent/Circulation.t
  2. 22
      t/db_dependent/Holds.t
  3. 2
      t/db_dependent/Holds/LocalHoldsPriority.t
  4. 2
      t/db_dependent/Holds/RevertWaitingStatus.t
  5. 18
      t/db_dependent/Items.t
  6. 2
      t/db_dependent/Items/DelItem.t
  7. 4
      t/db_dependent/Items/GetItemsForInventory.t
  8. 2
      t/db_dependent/Koha/BiblioUtils/Iterator.t
  9. 2
      t/db_dependent/Koha/Biblios.t
  10. 2
      t/db_dependent/Labels/t_Label.t
  11. 8
      t/db_dependent/OAI/Sets.t
  12. 4
      t/db_dependent/Reserves.t
  13. 2
      t/db_dependent/Serials.t
  14. 2
      t/lib/TestBuilder.pm

18
t/db_dependent/Circulation.t

@ -213,7 +213,7 @@ $dbh->do(
# CanBookBeRenewed tests
C4::Context->set_preference('ItemsDeniedRenewal','');
# Generate test biblio
my $biblio = $builder->gimme_a_biblio();
my $biblio = $builder->build_sample_biblio();
my $barcode = 'R00000342';
my $branch = $library2->{branchcode};
@ -906,7 +906,7 @@ $dbh->do(
my $branch = $library2->{branchcode};
#Create another record
my $biblio2 = $builder->gimme_a_biblio();
my $biblio2 = $builder->build_sample_biblio();
#Create third item
AddItem(
@ -985,7 +985,7 @@ $dbh->do(
my $barcode = '1234567890';
my $branch = $library2->{branchcode};
my $biblio = $builder->gimme_a_biblio();
my $biblio = $builder->build_sample_biblio();
#Create third item
my ( undef, undef, $itemnumber ) = AddItem(
@ -1042,7 +1042,7 @@ $dbh->do(
undef, 0,
.10, 1
);
my $biblio = $builder->gimme_a_biblio();
my $biblio = $builder->build_sample_biblio();
my $barcode1 = '1234';
my ( undef, undef, $itemnumber1 ) = AddItem(
@ -1125,7 +1125,7 @@ $dbh->do(
my $branch = $library->{branchcode};
#Create another record
my $biblio = $builder->gimme_a_biblio();
my $biblio = $builder->build_sample_biblio();
my (undef, undef, $itemnumber) = AddItem(
{
@ -1155,7 +1155,7 @@ $dbh->do(
{
my $library = $builder->build({ source => 'Branch' });
my $biblio = $builder->gimme_a_biblio();
my $biblio = $builder->build_sample_biblio();
my $barcode = 'just a barcode';
my ( undef, undef, $itemnumber ) = AddItem(
@ -1455,7 +1455,7 @@ subtest 'CanBookBeIssued + Statistic patrons "X"' => sub {
subtest 'MultipleReserves' => sub {
plan tests => 3;
my $biblio = $builder->gimme_a_biblio();
my $biblio = $builder->build_sample_biblio();
my $branch = $library2->{branchcode};
@ -1992,7 +1992,7 @@ subtest '_FixAccountForLostAndReturned' => sub {
);
my $library = $builder->build_object( { class => 'Koha::Libraries' } );
my $biblio = $builder->gimme_a_biblio({ author => 'Hall, Daria' });
my $biblio = $builder->build_sample_biblio({ author => 'Hall, Daria' });
subtest 'Full write-off tests' => sub {
@ -2357,7 +2357,7 @@ subtest '_FixAccountForLostAndReturned' => sub {
subtest '_FixOverduesOnReturn' => sub {
plan tests => 10;
my $biblio = $builder->gimme_a_biblio({ author => 'Hall, Kylie' });
my $biblio = $builder->build_sample_biblio({ author => 'Hall, Kylie' });
my $barcode = 'KD987654321';
my $branchcode = $library2->{branchcode};

22
t/db_dependent/Holds.t

@ -54,7 +54,7 @@ $insert_sth->execute('DUMMY');
$insert_sth->execute('ONLY1');
# Setup Test------------------------
my $biblio = $builder->gimme_a_biblio({ itemtype => 'DUMMY' });
my $biblio = $builder->build_sample_biblio({ itemtype => 'DUMMY' });
# Create item instance for testing.
my ($item_bibnum, $item_bibitemnum, $itemnumber)
@ -239,7 +239,7 @@ is( $hold->priority, '6', "Test AlterPriority(), move to bottom" );
# Note that canreservefromotherbranches has no effect if
# IndependentBranches is OFF.
my $foreign_biblio = $builder->gimme_a_biblio({ itemtype => 'DUMMY' });
my $foreign_biblio = $builder->build_sample_biblio({ itemtype => 'DUMMY' });
my ($foreign_item_bibnum, $foreign_item_bibitemnum, $foreign_itemnumber)
= AddItem({ homebranch => $branch_2, holdingbranch => $branch_2 } , $foreign_biblio->biblionumber);
$dbh->do('DELETE FROM issuingrules');
@ -284,7 +284,7 @@ ok(
{
# Regression test for bug 11336 # Test if ModReserve correctly recalculate the priorities
$biblio = $builder->gimme_a_biblio({ itemtype => 'DUMMY' });
$biblio = $builder->build_sample_biblio({ itemtype => 'DUMMY' });
($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1 } , $biblio->biblionumber);
my $reserveid1 = AddReserve($branch_1, $borrowernumbers[0], $biblio->biblionumber, '', 1);
($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1 } , $biblio->biblionumber);
@ -321,7 +321,7 @@ ok( CanItemBeReserved( $borrowernumbers[0], $itemnumber)->{status} eq 'damaged',
ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for damaged item with AllowHoldsOnDamagedItems disabled" );
# Regression test for bug 9532
$biblio = $builder->gimme_a_biblio({ itemtype => 'CANNOT' });
$biblio = $builder->build_sample_biblio({ itemtype => 'CANNOT' });
($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $branch_1, holdingbranch => $branch_1, itype => 'CANNOT' } , $biblio->biblionumber);
AddReserve(
$branch_1,
@ -369,7 +369,7 @@ $dbh->do(q{
INSERT INTO branch_item_rules (branchcode, itemtype, holdallowed, returnbranch)
VALUES (?, ?, ?, ?)
}, {}, $branch_1, 'CAN', 1, 'homebranch');
$biblio = $builder->gimme_a_biblio({ itemtype => 'CANNOT' });
$biblio = $builder->build_sample_biblio({ itemtype => 'CANNOT' });
($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem(
{ homebranch => $branch_1, holdingbranch => $branch_1, itype => 'CANNOT' } , $biblio->biblionumber);
is(CanItemBeReserved($borrowernumbers[0], $itemnumber)->{status}, 'notReservable',
@ -395,7 +395,7 @@ $dbh->do('DELETE FROM issues');
$dbh->do('DELETE FROM items');
$dbh->do('DELETE FROM biblio');
$biblio = $builder->gimme_a_biblio({ itemtype => 'ONLY1' });
$biblio = $builder->build_sample_biblio({ itemtype => 'ONLY1' });
( $item_bibnum, $item_bibitemnum, $itemnumber )
= AddItem( { homebranch => $branch_1, holdingbranch => $branch_1 }, $biblio->biblionumber );
@ -420,7 +420,7 @@ subtest 'Test max_holds per library/patron category' => sub {
$dbh->do('DELETE FROM issuingrules');
$dbh->do('DELETE FROM circulation_rules');
$biblio = $builder->gimme_a_biblio({ itemtype => 'TEST' });
$biblio = $builder->build_sample_biblio({ itemtype => 'TEST' });
( $item_bibnum, $item_bibitemnum, $itemnumber ) =
AddItem( { homebranch => $branch_1, holdingbranch => $branch_1 },
$biblio->biblionumber );
@ -490,7 +490,7 @@ subtest 'Test max_holds per library/patron category' => sub {
subtest 'Pickup location availability tests' => sub {
plan tests => 4;
$biblio = $builder->gimme_a_biblio({ itemtype => 'ONLY1' });
$biblio = $builder->build_sample_biblio({ itemtype => 'ONLY1' });
my ( $item_bibnum, $item_bibitemnum, $itemnumber )
= AddItem( { homebranch => $branch_1, holdingbranch => $branch_1 }, $biblio->biblionumber );
#Add a default rule to allow some holds
@ -547,21 +547,21 @@ subtest 'CanItemBeReserved / holds_per_day tests' => sub {
my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
# Create 3 biblios with items
my $biblio_1 = $builder->gimme_a_biblio({ itemtype => $itemtype->itemtype });
my $biblio_1 = $builder->build_sample_biblio({ itemtype => $itemtype->itemtype });
my ( undef, undef, $itemnumber_1 ) = AddItem(
{ homebranch => $library->branchcode,
holdingbranch => $library->branchcode
},
$biblio_1->biblionumber
);
my $biblio_2 = $builder->gimme_a_biblio({ itemtype => $itemtype->itemtype });
my $biblio_2 = $builder->build_sample_biblio({ itemtype => $itemtype->itemtype });
my ( undef, undef, $itemnumber_2 ) = AddItem(
{ homebranch => $library->branchcode,
holdingbranch => $library->branchcode
},
$biblio_2->biblionumber
);
my $biblio_3 = $builder->gimme_a_biblio({ itemtype => $itemtype->itemtype });
my $biblio_3 = $builder->build_sample_biblio({ itemtype => $itemtype->itemtype });
my ( undef, undef, $itemnumber_3 ) = AddItem(
{ homebranch => $library->branchcode,
holdingbranch => $library->branchcode

2
t/db_dependent/Holds/LocalHoldsPriority.t

@ -40,7 +40,7 @@ my $itemtype = $builder->build(
my $borrowers_count = 5;
my $biblio = $builder->gimme_a_biblio();
my $biblio = $builder->build_sample_biblio();
my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem(
{ homebranch => $library4->{branchcode},
holdingbranch => $library3->{branchcode},

2
t/db_dependent/Holds/RevertWaitingStatus.t

@ -46,7 +46,7 @@ t::lib::Mocks::mock_userenv({ flags => 1, userid => '1', branchcode => $branchco
my $borrowers_count = 3;
my $biblio = $builder->gimme_a_biblio();
my $biblio = $builder->build_sample_biblio();
my $item_barcode = 'my_barcode';
my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem(
{ homebranch => $branchcode,

18
t/db_dependent/Items.t

@ -56,7 +56,7 @@ subtest 'General Add, Get and Del tests' => sub {
# Create a biblio instance for testing
t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
my $biblio = $builder->gimme_a_biblio();
my $biblio = $builder->build_sample_biblio();
# Add an item.
my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $library->{branchcode}, holdingbranch => $library->{branchcode}, location => $location, itype => $itemtype->{itemtype} } , $biblio->biblionumber);
@ -168,7 +168,7 @@ subtest 'GetHiddenItemnumbers tests' => sub {
# Create a new biblio
t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
my $biblio = $builder->gimme_a_biblio();
my $biblio = $builder->build_sample_biblio();
# Add two items
my ( $item1_bibnum, $item1_bibitemnum, $item1_itemnumber ) = AddItem(
@ -266,7 +266,7 @@ subtest 'GetItemsInfo tests' => sub {
});
# Add a biblio
my $biblio = $builder->gimme_a_biblio();
my $biblio = $builder->build_sample_biblio();
# Add an item
my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem(
{
@ -357,8 +357,8 @@ subtest 'SearchItems test' => sub {
t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
my $cpl_items_before = SearchItemsByField( 'homebranch', $library1->{branchcode});
my $biblio = $builder->gimme_a_biblio({ title => 'Silence in the library' });
$builder->gimme_a_biblio({ title => 'Silence in the shadow' });
my $biblio = $builder->build_sample_biblio({ title => 'Silence in the library' });
$builder->build_sample_biblio({ title => 'Silence in the shadow' });
my (undef, $initial_items_count) = SearchItems(undef, {rows => 1});
@ -535,7 +535,7 @@ subtest 'Koha::Item(s) tests' => sub {
# Create a biblio and item for testing
t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
my $biblio = $builder->gimme_a_biblio();
my $biblio = $builder->build_sample_biblio();
my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem(
{
homebranch => $library1->{branchcode},
@ -576,7 +576,7 @@ subtest 'C4::Biblio::EmbedItemsInMarcBiblio' => sub {
source => 'Itemtype',
});
my $biblio = $builder->gimme_a_biblio();
my $biblio = $builder->build_sample_biblio();
my $item_infos = [
{ homebranch => $library1->{branchcode}, holdingbranch => $library1->{branchcode} },
{ homebranch => $library1->{branchcode}, holdingbranch => $library1->{branchcode} },
@ -703,7 +703,7 @@ subtest 'C4::Items::_build_default_values_for_mod_marc' => sub {
my $itemtype = $builder->build({ source => 'Itemtype' })->{itemtype};
# Create a record with a barcode
my $biblio = $builder->gimme_a_biblio({ frameworkcode => $framework->{frameworkcode} });
my $biblio = $builder->build_sample_biblio({ frameworkcode => $framework->{frameworkcode} });
my $item_record = new MARC::Record;
my $a_barcode = 'a barcode';
my $barcode_field = MARC::Field->new(
@ -849,7 +849,7 @@ subtest 'Test logging for ModItem' => sub {
# Create a biblio instance for testing
t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
my $biblio = $builder->gimme_a_biblio();
my $biblio = $builder->build_sample_biblio();
# Add an item.
my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $library->{branchcode}, holdingbranch => $library->{branchcode}, location => $location, itype => $itemtype->{itemtype} } , $biblio->biblionumber);

2
t/db_dependent/Items/DelItem.t

@ -16,7 +16,7 @@ my $library = $builder->build({
source => 'Branch',
});
my $biblio = $builder->gimme_a_biblio();
my $biblio = $builder->build_sample_biblio();
my ( $item_bibnum, $item_bibitemnum, $itemnumber );
( $item_bibnum, $item_bibitemnum, $itemnumber ) =

4
t/db_dependent/Items/GetItemsForInventory.t

@ -74,8 +74,8 @@ subtest 'Skip items with waiting holds' => sub {
my $title_1 = 'Title 1, ';
my $title_2 = 'Title 2, bizzarre one so doesn\'t already exist';
my $biblio_1 = $builder->gimme_a_biblio({ itemtype => $itemtype->itemtype, title => $title_1 });
my $biblio_2 = $builder->gimme_a_biblio({ itemtype => $itemtype->itemtype, title => $title_2 });
my $biblio_1 = $builder->build_sample_biblio({ itemtype => $itemtype->itemtype, title => $title_1 });
my $biblio_2 = $builder->build_sample_biblio({ itemtype => $itemtype->itemtype, title => $title_2 });
my ( $items_1, $first_items_count ) = GetItemsForInventory();
is( scalar @{$items_1}, $first_items_count, 'Results and count match' );

2
t/db_dependent/Koha/BiblioUtils/Iterator.t

@ -47,7 +47,7 @@ my $itemtype = $builder->build({
# Create a biblio instance for testing
t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
my $biblio = $builder->gimme_a_biblio();
my $biblio = $builder->build_sample_biblio();
# Add an item.
my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $library->{branchcode}, holdingbranch => $library->{branchcode}, location => $location, itype => $itemtype->{itemtype} } , $biblio->biblionumber);

2
t/db_dependent/Koha/Biblios.t

@ -143,7 +143,7 @@ subtest 'can_be_transferred' => sub {
my $library1 = $builder->build_object( { class => 'Koha::Libraries' } );
my $library2 = $builder->build_object( { class => 'Koha::Libraries' } );
my $library3 = $builder->build_object( { class => 'Koha::Libraries' } );
my $biblio = $builder->gimme_a_biblio({ itemtype => 'ONLY1' });
my $biblio = $builder->build_sample_biblio({ itemtype => 'ONLY1' });
my ($item_bibnum, $item_bibitemnum, $itemnumber)
= AddItem({ homebranch => $library1->branchcode, holdingbranch => $library1->branchcode }, $biblio->biblionumber);
my $item = Koha::Items->find($itemnumber);

2
t/db_dependent/Labels/t_Label.t

@ -59,7 +59,7 @@ my $itemtype =
t::lib::Mocks::mock_userenv({ branchcode => $branch_1 });
my $bibnum = $builder->gimme_a_biblio({ frameworkcode => $frameworkcode })->biblionumber;
my $bibnum = $builder->build_sample_biblio({ frameworkcode => $frameworkcode })->biblionumber;
# Create a helper item instance for testing
my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem(

8
t/db_dependent/OAI/Sets.t

@ -355,10 +355,10 @@ ok (!defined(AddOAISetsBiblios(my $arg=[])), 'AddOAISetsBiblios with a no HASH a
ok (defined(AddOAISetsBiblios($arg={})), 'AddOAISetsBiblios with a HASH argument is def');
# Create a biblio instance for testing
my $biblio_1 = $builder->gimme_a_biblio({ author => 'Moffat, Steven' });
my $biblio_1 = $builder->build_sample_biblio({ author => 'Moffat, Steven' });
my $biblionumber1 = $biblio_1->biblionumber;
isa_ok(\$biblionumber1, 'SCALAR', '$biblionumber1 is a SCALAR');
my $biblio_2 = $builder->gimme_a_biblio({ author => 'Moffat, Steven' });
my $biblio_2 = $builder->build_sample_biblio({ author => 'Moffat, Steven' });
my $biblionumber2 = $biblio_2->biblionumber;
isa_ok(\$biblionumber2, 'SCALAR', '$biblionumber2 is a SCALAR');
@ -521,7 +521,7 @@ ModOAISetMappings($setVH_id, $mappingsVH);
#Create a biblio notice corresponding at one of mappings
my $biblio_VH = $builder->gimme_a_biblio({ author => 'Victor Hugo' });
my $biblio_VH = $builder->build_sample_biblio({ author => 'Victor Hugo' });
my $biblionumberVH = $biblio_VH->biblionumber;
#Update
@ -577,7 +577,7 @@ ModOAISetMappings($setNotVH_id, $mappingsNotVH);
#Create a biblio notice corresponding at one of mappings
my $biblio_NotVH = $builder->gimme_a_biblio({ author => 'Sponge, Bob' });
my $biblio_NotVH = $builder->build_sample_biblio({ author => 'Sponge, Bob' });
my $biblionumberNotVH = $biblio_NotVH->biblionumber;
#Update

4
t/db_dependent/Reserves.t

@ -79,7 +79,7 @@ my $itemtype = $builder->build(
t::lib::Mocks::mock_userenv({ branchcode => $branch_1 });
my $bibnum = $builder->gimme_a_biblio({frameworkcode => $frameworkcode})->biblionumber;
my $bibnum = $builder->build_sample_biblio({frameworkcode => $frameworkcode})->biblionumber;
# Create a helper item instance for testing
my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem(
@ -212,7 +212,7 @@ $dbh->do(
$branch_2, 10, 2, 'homebranch',
);
my $bibnum2 = $builder->gimme_a_biblio({frameworkcode => $frameworkcode})->biblionumber;
my $bibnum2 = $builder->build_sample_biblio({frameworkcode => $frameworkcode})->biblionumber;
my ($itemnum_cpl, $itemnum_fpl);
( undef, undef, $itemnum_cpl ) = AddItem(

2
t/db_dependent/Serials.t

@ -143,7 +143,7 @@ subtest 'Values should not be erased on editing' => sub {
plan tests => 1;
my $biblio = $builder->gimme_a_biblio();
my $biblio = $builder->build_sample_biblio();
my $biblionumber = $biblio->biblionumber;
my ( $icn_tag, $icn_sf ) = GetMarcFromKohaField( 'items.itemcallnumber', '' );
my ( $it_tag, $it_sf ) = GetMarcFromKohaField( 'items.itype', '' );

2
t/lib/TestBuilder.pm

@ -127,7 +127,7 @@ sub build {
});
}
sub gimme_a_biblio {
sub build_sample_biblio {
my ( $self, $args ) = @_;
my $title = $args->{title} || 'Some boring read';

Loading…
Cancel
Save