7 eval "use DBIx::Class::CDBICompat;";
9 plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
12 eval "use DBD::SQLite";
13 plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 10);
19 DBICTest->init_schema();
21 DBICTest::CD->load_components(qw/CDBICompat::Pager/);
23 my ( $pager, $it ) = DBICTest::CD->page(
25 { order_by => 'title',
29 cmp_ok( $pager->entries_on_this_page, '==', 3, "entries_on_this_page ok" );
31 cmp_ok( $pager->next_page, '==', 2, "next_page ok" );
33 is( $it->next->title, "Caterwaulin' Blues", "iterator->next ok" );
38 is( $it->next, undef, "next past end of page ok" );
40 ( $pager, $it ) = DBICTest::CD->page(
44 disable_sql_paging => 1 } );
46 cmp_ok( $pager->total_entries, '==', 5, "disable_sql_paging total_entries ok" );
48 cmp_ok( $pager->previous_page, '==', 1, "disable_sql_paging previous_page ok" );
50 is( $it->next->title, "Caterwaulin' Blues", "disable_sql_paging iterator->next ok" );
54 is( $it->next, undef, "disable_sql_paging next past end of page ok" );
56 # based on a failing criteria submitted by waswas
57 ( $pager, $it ) = DBICTest::CD->page(
64 -not_like => 'Forkful%'
70 is( $it->count, 1, "complex abstract count ok" );