X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F76joins.t;h=23336b85a59db20d839073e04836a86c1728b1c6;hb=e8fcf76f98ebd3cc99638765220d0024380bdd02;hp=f5ab52d0c74c0e5b627df625a5b55525368c28c8;hpb=0f6fc7050c1f6120a1bae77ec57def4e965ac332;p=dbsrgits%2FDBIx-Class.git diff --git a/t/76joins.t b/t/76joins.t index f5ab52d..23336b8 100644 --- a/t/76joins.t +++ b/t/76joins.t @@ -33,7 +33,7 @@ if( $schema->storage->dbh->get_info(17) eq 'SQLite' && } # test the abstract join => SQL generator -my $sa = new DBIC::SQL::Abstract; +my $sa = new DBIx::Class::SQLAHacks; my @j = ( { child => 'person' }, @@ -140,7 +140,7 @@ my $rs = $schema->resultset("CD")->search( ] ] } ); -cmp_ok( $rs + 0, '==', 1, "Single record in resultset"); +is( $rs + 0, 1, "Single record in resultset"); is($rs->first->title, 'Forkful of bees', 'Correct record returned'); @@ -148,7 +148,7 @@ $rs = $schema->resultset("CD")->search( { 'year' => 2001, 'artist.name' => 'Caterwauler McCrae' }, { join => 'artist' }); -cmp_ok( $rs + 0, '==', 1, "Single record in resultset"); +is( $rs + 0, 1, "Single record in resultset"); is($rs->first->title, 'Forkful of bees', 'Correct record returned'); @@ -157,7 +157,7 @@ $rs = $schema->resultset("CD")->search( 'liner_notes.notes' => 'Kill Yourself!' }, { join => [ qw/artist liner_notes/ ] }); -cmp_ok( $rs + 0, '==', 1, "Single record in resultset"); +is( $rs + 0, 1, "Single record in resultset"); is($rs->first->title, 'Come Be Depressed With Us', 'Correct record returned'); @@ -166,7 +166,7 @@ $rs = $schema->resultset("CD")->search( { 'artist' => 1 }, { join => [qw/artist/], order_by => 'artist.name' } ); -cmp_ok( scalar $rs->all, '==', scalar $rs->slice(0, $rs->count - 1), 'slice() with join has same count as all()' ); +is( scalar $rs->all, scalar $rs->slice(0, $rs->count - 1), 'slice() with join has same count as all()' ); ok(!$rs->slice($rs->count+1000, $rs->count+1002)->count, 'Slicing beyond end of rs returns a zero count'); @@ -175,7 +175,7 @@ $rs = $schema->resultset("Artist")->search( { 'liner_notes.notes' => 'Kill Yourself!' }, { join => { 'cds' => 'liner_notes' } }); -cmp_ok( $rs->count, '==', 1, "Single record in resultset"); +is( $rs->count, 1, "Single record in resultset"); is($rs->first->name, 'We Are Goth', 'Correct record returned'); @@ -206,8 +206,8 @@ is($rs->first->name, 'We Are Goth', 'Correct record returned'); return $schema->resultset("TwoKeys")->count; } - cmp_ok(cd_count(), '==', 8, '8 rows in table cd'); - cmp_ok(tk_count(), '==', 7, '7 rows in table twokeys'); + is(cd_count(), 8, '8 rows in table cd'); + is(tk_count(), 7, '7 rows in table twokeys'); sub artist1 { return $schema->resultset("CD")->search( @@ -222,13 +222,13 @@ is($rs->first->name, 'We Are Goth', 'Correct record returned'); ); } - cmp_ok( artist1()->count, '==', 3, '3 Caterwauler McCrae CDs' ); + is( artist1()->count, 3, '3 Caterwauler McCrae CDs' ); ok( artist1()->delete, 'Successfully deleted 3 CDs' ); - cmp_ok( artist1()->count, '==', 0, '0 Caterwauler McCrae CDs' ); - cmp_ok( artist2()->count, '==', 2, '3 Random Boy Band CDs' ); + is( artist1()->count, 0, '0 Caterwauler McCrae CDs' ); + is( artist2()->count, 2, '3 Random Boy Band CDs' ); ok( artist2()->update( { 'artist' => 1 } ) ); - cmp_ok( artist2()->count, '==', 0, '0 Random Boy Band CDs' ); - cmp_ok( artist1()->count, '==', 2, '2 Caterwauler McCrae CDs' ); + is( artist2()->count, 0, '0 Random Boy Band CDs' ); + is( artist1()->count, 2, '2 Caterwauler McCrae CDs' ); # test update on multi-column-pk sub tk1 { @@ -246,12 +246,12 @@ is($rs->first->name, 'We Are Goth', 'Correct record returned'); { join => [qw/artist/]} ); } - cmp_ok( tk2()->count, '==', 2, 'TwoKeys count == 2' ); - cmp_ok( tk1()->count, '==', 2, 'TwoKeys count == 2' ); + is( tk2()->count, 2, 'TwoKeys count == 2' ); + is( tk1()->count, 2, 'TwoKeys count == 2' ); ok( tk1()->update( { artist => 1 } ) ); - cmp_ok( tk1()->count, '==', 0, 'TwoKeys count == 0' ); - cmp_ok( tk2()->count, '==', 4, '2 Caterwauler McCrae CDs' ); + is( tk1()->count, 0, 'TwoKeys count == 0' ); + is( tk2()->count, 4, '2 Caterwauler McCrae CDs' ); ok( tk2()->delete, 'Successfully deleted 4 CDs' ); - cmp_ok(cd_count(), '==', 5, '5 rows in table cd'); - cmp_ok(tk_count(), '==', 3, '3 rows in table twokeys'); + is(cd_count(), 5, '5 rows in table cd'); + is(tk_count(), 3, '3 rows in table twokeys'); }