From: Aran Deltac Date: Thu, 18 May 2006 03:15:24 +0000 (-0700) Subject: Merge 'reorganize_tests' into 'DBIx-Class-current' X-Git-Tag: v0.07002~75^2~167 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9eba6e064068c3fde1e7c075c9133caea7adb4c0;p=dbsrgits%2FDBIx-Class.git Merge 'reorganize_tests' into 'DBIx-Class-current' r1656@moss (orig r1655): bluefeet | 2006-05-17 22:15:24 -0700 Delete basicrels tests. Modify run tests to use new syntax. Remove helperrels test wrappers. --- 9eba6e064068c3fde1e7c075c9133caea7adb4c0 diff --cc t/run/12pg.tl index 5432a60,754a830..81aae04 --- a/t/run/12pg.tl +++ b/t/run/12pg.tl @@@ -4,10 -9,10 +9,10 @@@ my ($dsn, $user, $pass) = @ENV{map { "D #warn "$dsn $user $pass"; - plan skip_all, 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test' + plan skip_all => 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test' - . ' (note: creates and drops a table named artist!)' unless ($dsn && $user); + . ' (note: creates and drops tables named artist and casecheck!)' unless ($dsn && $user); -plan tests => 4; +plan tests => 8; DBICTest::Schema->compose_connection('PgTest' => $dsn, $user, $pass); @@@ -57,19 -60,6 +62,16 @@@ like($artistid_defval is_deeply($type_info, $test_type_info, 'columns_info_for - column data types'); +my $name_info = PgTest::Casecheck->column_info( 'name' ); +is( $name_info->{size}, 1, "Case sensitive matching info for 'name'" ); + +my $NAME_info = PgTest::Casecheck->column_info( 'NAME' ); +is( $NAME_info->{size}, 2, "Case sensitive matching info for 'NAME'" ); + +my $uc_name_info = PgTest::Casecheck->column_info( 'uc_name' ); +is( $uc_name_info->{size}, 3, "Case insensitive matching info for 'uc_name'" ); + $dbh->do("DROP TABLE testschema.artist;"); +$dbh->do("DROP TABLE testschema.casecheck;"); $dbh->do("DROP SCHEMA testschema;"); - } - - 1; diff --cc t/run/16joins.tl index c83aa7c,63e0363..069626a --- a/t/run/16joins.tl +++ b/t/run/16joins.tl @@@ -273,6 -283,22 +279,3 @@@ $schema->storage->debug(0) cmp_ok($queries, '==', 1, 'Only one query run'); - } # end run_tests - - 1; -# has_many resulting in an additional select if no records available despite prefetch -my $track = $schema->resultset("Artist")->create( { - artistid => 4, - name => 'Artist without CDs', -} ); - -$queries = 0; -$schema->storage->debug(1); - -my $artist_without_cds = $schema->resultset("Artist")->find(4, { - join => [qw/ cds /], - prefetch => [qw/ cds /], -}); -my @no_cds = $artist_without_cds->cds; - -is($queries, 1, 'prefetch ran only 1 sql statement'); - -$schema->storage->debug(0); - diff --cc t/run/28result_set_column.tl index 8898878,e05dbb4..c062a23 --- a/t/run/28result_set_column.tl +++ b/t/run/28result_set_column.tl @@@ -1,7 -1,13 +1,13 @@@ - sub run_tests { - my $schema = shift; + use strict; + use warnings; + + use Test::More; + use lib qw(t/lib); + use DBICTest; + + my $schema = DBICTest::init_schema(); -plan tests => 5; +plan tests => 8; my $rs = $cd = $schema->resultset("CD")->search({}); @@@ -18,22 -24,3 +24,20 @@@ is($rs_title->min, 'Caterwaulin\' Blues cmp_ok($rs_year->sum, '==', 9996, "three artists returned"); +my $psrs = $schema->resultset('CD')->search({}, + { + '+select' => \'COUNT(*)', + '+as' => 'count' + } +); +ok(defined($psrs->get_column('count')), '+select/+as count'); + +$psrs = $schema->resultset('CD')->search({}, + { + '+select' => [ \'COUNT(*)', 'title' ], + '+as' => [ 'count', 'addedtitle' ] + } +); +ok(defined($psrs->get_column('count')), '+select/+as arrayref count'); +ok(defined($psrs->get_column('addedtitle')), '+select/+as title'); - } + - 1;