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

(-)a/t/db_dependent/Koha/Objects.t (-10 / +14 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 16;
22
use Test::More tests => 15;
23
use Test::Warn;
23
use Test::Warn;
24
24
25
use Koha::Authority::Types;
25
use Koha::Authority::Types;
Lines 74-85 subtest 'update' => sub { Link Here
74
    is( Koha::Cities->search( { city_country => 'UK' } )->count, 0, 'Koha::Objects->update should have updated the 3 rows' );
74
    is( Koha::Cities->search( { city_country => 'UK' } )->count, 0, 'Koha::Objects->update should have updated the 3 rows' );
75
};
75
};
76
76
77
subtest 'pager' => sub {
78
    plan tests => 1;
79
    my $pager = Koha::Patrons->search( {}, { page => 1, rows => 2 } )->pager;
80
    is( ref($pager), 'DBIx::Class::ResultSet::Pager', 'Koha::Objects->pager returns a valid DBIx::Class object' );
81
};
82
83
subtest 'reset' => sub {
77
subtest 'reset' => sub {
84
    plan tests => 3;
78
    plan tests => 3;
85
79
Lines 215-234 subtest 'Exceptions' => sub { Link Here
215
209
216
$schema->storage->txn_rollback;
210
$schema->storage->txn_rollback;
217
211
218
subtest '->is_paged tests' => sub {
212
subtest '->is_paged and ->pager tests' => sub {
219
213
220
    plan tests => 2;
214
    plan tests => 5;
221
215
222
    $schema->storage->txn_begin;
216
    $schema->storage->txn_begin;
223
217
218
    # Delete existing patrons
219
    Koha::Patrons->search->delete;
220
    # Create 10 patrons
224
    foreach (1..10) {
221
    foreach (1..10) {
225
        $builder->build_object({ class => 'Koha::Patrons' });
222
        $builder->build_object({ class => 'Koha::Patrons' });
226
    }
223
    }
227
224
225
    # Non-paginated search
228
    my $patrons = Koha::Patrons->search();
226
    my $patrons = Koha::Patrons->search();
227
    is( $patrons->count, 10, 'Search returns all patrons' );
229
    ok( !$patrons->is_paged, 'Search is not paged' );
228
    ok( !$patrons->is_paged, 'Search is not paged' );
229
230
    # Paginated search
230
    $patrons = Koha::Patrons->search( undef, { 'page' => 1, 'rows' => 3 } );
231
    $patrons = Koha::Patrons->search( undef, { 'page' => 1, 'rows' => 3 } );
232
    is( $patrons->count, 3, 'Search returns only one page, 3 patrons' );
231
    ok( $patrons->is_paged, 'Search is paged' );
233
    ok( $patrons->is_paged, 'Search is paged' );
234
    my $pager = $patrons->pager;
235
    is( ref($patrons->pager), 'DBIx::Class::ResultSet::Pager',
236
       'Koha::Objects->pager returns a valid DBIx::Class object' );
232
237
233
    $schema->storage->txn_rollback;
238
    $schema->storage->txn_rollback;
234
}
239
}
235
- 

Return to bug 19209