[Bast-commits] r6369 - DBIx-Class/0.08/trunk/t
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Fri May 22 08:28:59 GMT 2009
Author: ribasushi
Date: 2009-05-22 08:28:58 +0000 (Fri, 22 May 2009)
New Revision: 6369
Modified:
DBIx-Class/0.08/trunk/t/745db2.t
Log:
Extend DB2 test
Modified: DBIx-Class/0.08/trunk/t/745db2.t
===================================================================
--- DBIx-Class/0.08/trunk/t/745db2.t 2009-05-22 06:09:05 UTC (rev 6368)
+++ DBIx-Class/0.08/trunk/t/745db2.t 2009-05-22 08:28:58 UTC (rev 6369)
@@ -12,7 +12,7 @@
plan skip_all => 'Set $ENV{DBICTEST_DB2_DSN}, _USER and _PASS to run this test'
unless ($dsn && $user);
-plan tests => 6;
+plan tests => 9;
my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
@@ -25,25 +25,37 @@
# This is in core, just testing that it still loads ok
$schema->class('Artist')->load_components('PK::Auto');
+my $ars = $schema->resultset('Artist');
+
# test primary key handling
-my $new = $schema->resultset('Artist')->create({ name => 'foo' });
+my $new = $ars->create({ name => 'foo' });
ok($new->artistid, "Auto-PK worked");
-# test LIMIT support
+my $init_count = $ars->count;
for (1..6) {
- $schema->resultset('Artist')->create({ name => 'Artist ' . $_ });
+ $ars->create({ name => 'Artist ' . $_ });
}
-my $it = $schema->resultset('Artist')->search( {},
- { rows => 3,
- order_by => 'artistid'
- }
+is ($ars->count, $init_count + 6, 'Simple count works');
+
+# test LIMIT support
+my $it = $ars->search( {},
+ {
+ rows => 3,
+ order_by => 'artistid'
+ }
);
is( $it->count, 3, "LIMIT count ok" );
+
+my @all = $it->all;
+is (@all, 3, 'Number of ->all objects matches count');
+
+$it->reset
is( $it->next->name, "foo", "iterator->next ok" );
-$it->next;
+is( $it->next->name, "Artist 1", "iterator->next ok" );
is( $it->next->name, "Artist 2", "iterator->next ok" );
-is( $it->next, undef, "next past end of resultset ok" );
+is( $it->next, undef, "next past end of resultset ok" ); # this can not succeed if @all > 3
+
my $test_type_info = {
'artistid' => {
'data_type' => 'INTEGER',
More information about the Bast-commits
mailing list