View | Details | Raw Unified | Return to bug 17091
Collapse All | Expand All

(-)a/Koha/Objects.pm (-17 lines)
Lines 150-172 sub next { Link Here
150
    return $object;
150
    return $object;
151
}
151
}
152
152
153
=head3 Koha::Objects->reset();
154
155
Koha::Objects->reset();
156
157
resets iteration so the next call to next() will start agein
158
with the first object in a set.
159
160
=cut
161
162
sub reset {
163
    my ( $self ) = @_;
164
165
    $self->_resultset()->reset();
166
167
    return $self;
168
}
169
170
=head3 Koha::Objects->as_list();
153
=head3 Koha::Objects->as_list();
171
154
172
Koha::Objects->as_list();
155
Koha::Objects->as_list();
(-)a/t/db_dependent/Koha/Objects.t (-2 / +10 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 4;
22
use Test::More tests => 5;
23
23
24
use Koha::Authority::Types;
24
use Koha::Authority::Types;
25
use Koha::Cities;
25
use Koha::Cities;
Lines 57-61 subtest 'pager' => sub { Link Here
57
    is( ref($pager), 'DBIx::Class::ResultSet::Pager', 'Koha::Objects->pager returns a valid DBIx::Class object' );
57
    is( ref($pager), 'DBIx::Class::ResultSet::Pager', 'Koha::Objects->pager returns a valid DBIx::Class object' );
58
};
58
};
59
59
60
subtest 'reset' => sub {
61
    plan tests => 1;
62
    my $builder   = t::lib::TestBuilder->new;
63
    my $patrons = Koha::Patrons->search;
64
    my $first_borrowernumber = $patrons->next->borrowernumber;
65
    my $second_borrowernumber = $patrons->next->borrowernumber;
66
    is( $patrons->reset->next->borrowernumber, $first_borrowernumber, 'Koha::Objects->reset should work as expected');
67
};
68
60
$schema->storage->txn_rollback;
69
$schema->storage->txn_rollback;
61
1;
70
1;
62
- 

Return to bug 17091