From ebce48a752a97245b6cdbd12c82d2cb6ea621bd5 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 8 Nov 2018 17:06:54 -0300 Subject: [PATCH] Bug 21798: We need t::lib::TestBuilder::gimme_a_biblio Signed-off-by: Tomas Cohen Arazi Signed-off-by: Marcel de Rooy Signed-off-by: Nick Clemens --- t/lib/TestBuilder.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/t/lib/TestBuilder.pm b/t/lib/TestBuilder.pm index b01074c458..452d21ef92 100644 --- a/t/lib/TestBuilder.pm +++ b/t/lib/TestBuilder.pm @@ -125,6 +125,22 @@ sub build { }); } +sub gimme_a_biblio { + my ( $self, $args ) = @_; + + my $itemtype = $args->{itemtype} || $self->build_object({ class => 'Koha::ItemTypes' })->itemtype; + my $title = $args->{title} || 'Some boring read'; + + my $record = MARC::Record->new(); + $record->append_fields( + MARC::Field->new( '245', ' ', ' ', a => $title ), + MARC::Field->new( '942', ' ', ' ', c => $itemtype ) + ); + + my ($biblio_id) = AddBiblio( $record, '' ); + return Koha::Biblios->find($biblio_id); +} + # ------------------------------------------------------------------------------ # Internal helper routines -- 2.39.5