From 7a4e10796063c595224840e37000cbed61aa54f0 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 9 Aug 2016 15:58:31 +0100 Subject: [PATCH] [SIGNED-OFF]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 --- 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 a1ee20d..1ff33b3 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 bb75747..d1cb9e1 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; -- 1.7.10.4