From 6dd4663121591b518324b9df6b0623e4d3a4a63a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 18 Feb 2022 11:01:55 +0100 Subject: [PATCH] Bug 29625: Add test for get_all_biblios_iterator Signed-off-by: Jonathan Druart --- t/db_dependent/Koha/BiblioUtils/Iterator.t | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/t/db_dependent/Koha/BiblioUtils/Iterator.t b/t/db_dependent/Koha/BiblioUtils/Iterator.t index ecc6db365c1..9b359541238 100755 --- a/t/db_dependent/Koha/BiblioUtils/Iterator.t +++ b/t/db_dependent/Koha/BiblioUtils/Iterator.t @@ -17,14 +17,12 @@ use Modern::Perl; -use Test::More tests => 3; +use Test::More tests => 7; use_ok('Koha::BiblioUtils'); use_ok('Koha::BiblioUtils::Iterator'); -use C4::Items; -use C4::Biblio; -use DBI; +use Koha::Database; use t::lib::TestBuilder; use t::lib::Mocks; @@ -60,4 +58,13 @@ my @result_tags = map { $_->tag() } $record->field('...'); my @sorted_tags = sort @result_tags; is_deeply(\@sorted_tags,$expected_tags, "Got the same tags as expected"); + +my $biblio_2 = $builder->build_sample_biblio(); +my $biblio_3 = $builder->build_sample_biblio(); +my $records = Koha::BiblioUtils->get_all_biblios_iterator(); +is( $records->next->id, $biblio->biblionumber ); +is( $records->next->id, $biblio_2->biblionumber ); +is( $records->next->id, $biblio_3->biblionumber ); +is( $records->next, undef, 'no more record' ); + $schema->storage->txn_rollback(); -- 2.25.1