From c253af2e519570c4024891dc4d1e81743a2c5fc2 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 9 Aug 2016 15:58:31 +0100 Subject: [PATCH] Bug 17091: Remove explicit declaration of Koha::Objects->reset Test plan: prove t/db_dependent/Koha/Objects.t should return green Signed-off-by: Hector Castro Signed-off-by: Kyle M Hall Signed-off-by: Brendan Gallagher --- Koha/Objects.pm | 17 ----------------- t/db_dependent/Koha/Objects.t | 11 ++++++++++- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/Koha/Objects.pm b/Koha/Objects.pm index a1ee20d28f..1ff33b3fdf 100644 --- a/Koha/Objects.pm +++ b/Koha/Objects.pm @@ -150,23 +150,6 @@ sub next { return $object; } -=head3 Koha::Objects->reset(); - -Koha::Objects->reset(); - -resets iteration so the next call to next() will start agein -with the first object in a set. - -=cut - -sub reset { - my ( $self ) = @_; - - $self->_resultset()->reset(); - - return $self; -} - =head3 Koha::Objects->as_list(); Koha::Objects->as_list(); diff --git a/t/db_dependent/Koha/Objects.t b/t/db_dependent/Koha/Objects.t index bb75747ead..d1cb9e147a 100644 --- a/t/db_dependent/Koha/Objects.t +++ b/t/db_dependent/Koha/Objects.t @@ -19,7 +19,7 @@ use Modern::Perl; -use Test::More tests => 4; +use Test::More tests => 5; use Koha::Authority::Types; use Koha::Cities; @@ -57,5 +57,14 @@ subtest 'pager' => sub { is( ref($pager), 'DBIx::Class::ResultSet::Pager', 'Koha::Objects->pager returns a valid DBIx::Class object' ); }; +subtest 'reset' => sub { + plan tests => 1; + my $builder = t::lib::TestBuilder->new; + my $patrons = Koha::Patrons->search; + my $first_borrowernumber = $patrons->next->borrowernumber; + my $second_borrowernumber = $patrons->next->borrowernumber; + is( $patrons->reset->next->borrowernumber, $first_borrowernumber, 'Koha::Objects->reset should work as expected'); +}; + $schema->storage->txn_rollback; 1; -- 2.39.5