7 eval "use DBIx::Class::CDBICompat;";
9 plan (skip_all => 'Class::Trigger and DBIx::ContextualFetch required');
19 DBICTest::Schema::CD->load_components(qw/CDBICompat CDBICompat::Pager/);
21 my $schema = DBICTest->init_schema(compose_connection => 1);
23 DBICTest::CD->result_source_instance->schema->storage($schema->storage);
25 my ( $pager, $it ) = DBICTest::CD->page(
27 { order_by => 'title',
31 cmp_ok( $pager->entries_on_this_page, '==', 3, "entries_on_this_page ok" );
33 cmp_ok( $pager->next_page, '==', 2, "next_page ok" );
35 is( $it->next->title, "Caterwaulin' Blues", "iterator->next ok" );
40 is( $it->next, undef, "next past end of page ok" );
42 ( $pager, $it ) = DBICTest::CD->page(
46 disable_sql_paging => 1 } );
48 cmp_ok( $pager->total_entries, '==', 5, "disable_sql_paging total_entries ok" );
50 cmp_ok( $pager->previous_page, '==', 1, "disable_sql_paging previous_page ok" );
52 is( $it->next->title, "Caterwaulin' Blues", "disable_sql_paging iterator->next ok" );
56 is( $it->next, undef, "disable_sql_paging next past end of page ok" );
58 # based on a failing criteria submitted by waswas
59 ( $pager, $it ) = DBICTest::CD->page(
66 -not_like => 'Forkful%'
72 is( $it->count, 1, "complex abstract count ok" );