1 use DBIx::Class::Optional::Dependencies -skip_all_without => 'cdbicompat';
11 DBICTest::Schema::CD->load_components(qw/CDBICompat CDBICompat::Pager/);
13 my $schema = DBICTest->init_schema(compose_connection => 1);
15 DBICTest::CD->result_source_instance->schema->storage($schema->storage);
17 my ( $pager, $it ) = DBICTest::CD->page(
19 { order_by => 'title',
23 cmp_ok( $pager->entries_on_this_page, '==', 3, "entries_on_this_page ok" );
25 cmp_ok( $pager->next_page, '==', 2, "next_page ok" );
27 is( $it->next->title, "Caterwaulin' Blues", "iterator->next ok" );
32 is( $it->next, undef, "next past end of page ok" );
34 ( $pager, $it ) = DBICTest::CD->page(
38 disable_sql_paging => 1 } );
40 cmp_ok( $pager->total_entries, '==', 5, "disable_sql_paging total_entries ok" );
42 cmp_ok( $pager->previous_page, '==', 1, "disable_sql_paging previous_page ok" );
44 is( $it->next->title, "Caterwaulin' Blues", "disable_sql_paging iterator->next ok" );
48 is( $it->next, undef, "disable_sql_paging next past end of page ok" );
50 # based on a failing criteria submitted by waswas
51 ( $pager, $it ) = DBICTest::CD->page(
58 -not_like => 'Forkful%'
64 is( $it->count, 1, "complex abstract count ok" );