From: Peter Rabbitson Date: Tue, 10 Aug 2010 13:08:45 +0000 (+0200) Subject: Add a Pg limit test (just to extend coverage) X-Git-Tag: v0.08124~101^2~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9727774577b1cbf4d0a3c5eb2def2c19a2ba0b17;p=dbsrgits%2FDBIx-Class.git Add a Pg limit test (just to extend coverage) --- diff --git a/t/72pg.t b/t/72pg.t index 162c276..a981fc8 100644 --- a/t/72pg.t +++ b/t/72pg.t @@ -53,6 +53,27 @@ DBICTest::Schema->load_classes( map {s/.+:://;$_} @test_classes ) if @test_class ok (!$s->storage->_dbh, 'still not connected'); } +# test LIMIT support +{ + my $schema = DBICTest::Schema->connect($dsn, $user, $pass); + drop_test_schema($schema); + create_test_schema($schema); + for (1..6) { + $schema->resultset('Artist')->create({ name => 'Artist ' . $_ }); + } + my $it = $schema->resultset('Artist')->search( {}, + { rows => 3, + offset => 2, + order_by => 'artistid' } + ); + is( $it->count, 3, "LIMIT count ok" ); # ask for 3 rows out of 6 artists + is( $it->next->name, "Artist 3", "iterator->next ok" ); + $it->next; + $it->next; + $it->next; + is( $it->next, undef, "next past end of resultset ok" ); +} + # check if we indeed do support stuff my $test_server_supports_insert_returning = do { my $v = DBICTest::Schema->connect($dsn, $user, $pass)