Browse Source

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 <hector.hecaxmmx@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
16.11.x
Jonathan Druart 8 years ago
committed by Brendan Gallagher
parent
commit
c253af2e51
  1. 17
      Koha/Objects.pm
  2. 11
      t/db_dependent/Koha/Objects.t

17
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();

11
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;

Loading…
Cancel
Save