[Bast-commits] r9578 -
DBIx-Class/0.08/branches/_abandoned_but_possibly_useful/view-deps/t
amiri at dev.catalyst.perl.org
amiri at dev.catalyst.perl.org
Thu Jun 3 14:15:37 GMT 2010
Author: amiri
Date: 2010-06-03 15:15:37 +0100 (Thu, 03 Jun 2010)
New Revision: 9578
Removed:
DBIx-Class/0.08/branches/_abandoned_but_possibly_useful/view-deps/t/sql/
Modified:
DBIx-Class/0.08/branches/_abandoned_but_possibly_useful/view-deps/t/105view_deps.t
Log:
Committing thing for move to git.
Modified: DBIx-Class/0.08/branches/_abandoned_but_possibly_useful/view-deps/t/105view_deps.t
===================================================================
--- DBIx-Class/0.08/branches/_abandoned_but_possibly_useful/view-deps/t/105view_deps.t 2010-06-03 10:54:57 UTC (rev 9577)
+++ DBIx-Class/0.08/branches/_abandoned_but_possibly_useful/view-deps/t/105view_deps.t 2010-06-03 14:15:37 UTC (rev 9578)
@@ -23,13 +23,8 @@
#################### DEPS
-my @sql_files = glob("t/sql/ViewDeps*.sql");
-for (@sql_files) {
- ok( unlink($_), "Deleted old SQL $_ OK" );
-}
-
-my $schema = ViewDeps->connect( 'dbi:SQLite::memory:',
- { quote_char => '"', } );
+my $schema
+ = ViewDeps->connect( 'dbi:SQLite::memory:', { quote_char => '"', } );
ok( $schema, 'Connected to ViewDeps schema OK' );
my $deps_ref = {
@@ -43,56 +38,35 @@
} @{ [ $schema->sources ] }
};
-my @sorted_sources =
- sort {
- keys %{ $deps_ref->{$a} || {} }
- <=>
- keys %{ $deps_ref->{$b} || {} }
+my @sorted_sources = sort {
+ keys %{ $deps_ref->{$a} || {} } <=> keys %{ $deps_ref->{$b} || {} }
|| $a cmp $b
}
keys %$deps_ref;
#################### DEPLOY
-my $ddl_dir = "t/sql";
-$schema->create_ddl_dir( [ 'PostgreSQL', 'MySQL', 'SQLite' ], 0.1, $ddl_dir );
-
-ok( -e $_, "$_ was created successfully" ) for @sql_files;
-
$schema->deploy( { add_drop_table => 1 } );
#################### DOES ORDERING WORK?
my $tr = $schema->{sqlt};
-my @keys = keys %{$tr->{views}};
+my @keys = keys %{ $tr->{views} };
-my @sqlt_sources =
- sort {
- $tr->{views}->{$a}->{order}
- cmp
- $tr->{views}->{$b}->{order}
- }
+my @sqlt_sources
+ = sort { $tr->{views}->{$a}->{order} cmp $tr->{views}->{$b}->{order} }
@keys;
-is_deeply(\@sorted_sources,\@sqlt_sources,"SQLT view order triumphantly matches our order.");
+is_deeply( \@sorted_sources, \@sqlt_sources,
+ "SQLT view order triumphantly matches our order." );
#################### AND WHAT ABOUT USING THE SCHEMA?
-my $a_name_rs = $schema->resultset('ANameArtists');
-my $ab_name_rs = $schema->resultset('AbNameArtists');
-my $aba_name_rs = $schema->resultset('AbaNameArtists');
-my $aba_name_cds_rs = $schema->resultset('AbaNameArtistsAnd2010CDsWithManyTracks');
-my $track_five_rs = $schema->resultset('TrackNumberFives');
-my $year_2010_rs = $schema->resultset('Year2010CDs');
-my $year_2010_cds_rs = $schema->resultset('Year2010CDsWithManyTracks');
+lives_ok( sub { $schema->resultset($_)->next }, "Query on $_ succeeds" )
+ for grep {
+ $schema->resultset($_)
+ ->result_source->isa('DBIx::Class::ResultSource::View')
+ } @{ [ $schema->sources ] };
-ok($a_name_rs, "ANameArtists resultset is OK");
-ok($ab_name_rs, "AbNameArtists resultset is OK");
-ok($aba_name_rs, "AbaNameArtists resultset is OK");
-ok($aba_name_cds_rs, "AbaNameArtistsAnd2010CDsWithManyTracks resultset is OK");
-ok($track_five_rs, "TrackNumberFives resultset is OK");
-ok($year_2010_rs, "Year2010CDs resultset is OK");
-ok($year_2010_cds_rs, "Year2010CDsWithManyTracks resultset is OK");
-
done_testing;
More information about the Bast-commits
mailing list