Finish ViewDeps: fix a join in test class, put attribs on Parser, add resultset tests...
Amiri Barksdale [Wed, 2 Jun 2010 00:45:19 +0000 (00:45 +0000)]
lib/SQL/Translator/Parser/DBIx/Class.pm
t/105view_deps.t
t/lib/ViewDeps/Result/Year2010CDsWithManyTracks.pm

index 433a27f..fc95801 100644 (file)
@@ -453,9 +453,15 @@ Limit the amount of parsed sources by supplying an explicit list of source names
 
 L<SQL::Translator>, L<DBIx::Class::Schema>
 
-=head1 AUTHORS
+=head1 AUTHOR
 
-See L<DBIx::Class/CONTRIBUTORS>.
+Jess Robinson
+
+=head2 CONTRIBUTORS
+
+Matt Trout
+Ash Berlin
+Amiri Barksdale
 
 =head1 LICENSE
 
index c285c94..7905bd5 100644 (file)
@@ -28,7 +28,7 @@ for (@sql_files) {
     ok( unlink($_), "Deleted old SQL $_ OK" );
 }
 
-my $schema = ViewDeps->connect( 'dbi:SQLite:dbname=t/var/viewdeps.db',
+my $schema = ViewDeps->connect( 'dbi:SQLite::memory:',
     { quote_char => '"', } );
 ok( $schema, 'Connected to ViewDeps schema OK' );
 
@@ -77,4 +77,22 @@ my @sqlt_sources =
 
 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');
+
+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;
index 82313c5..c6e4144 100644 (file)
@@ -8,7 +8,7 @@ use base 'ViewDeps::Result::Year2010CDs';
 __PACKAGE__->table_class('DBIx::Class::ResultSource::View');
 __PACKAGE__->table('year_2010_cds_with_many_tracks');
 __PACKAGE__->result_source_instance->view_definition(
-    "SELECT cd.id,cd.title,cd.artist,cd.year,cd.number_tracks,art.id FROM year_2010_cds cd,artwork art WHERE cd.number_tracks > 10 AND art.cd = cd.id"
+    "SELECT cd.id,cd.title,cd.artist,cd.year,cd.number_tracks,art.file FROM year_2010_cds cd JOIN artwork art on art.cd = cd.id WHERE cd.number_tracks > 10"
 );
 
 __PACKAGE__->result_source_instance->deploy_depends_on(
@@ -20,7 +20,7 @@ __PACKAGE__->add_columns(
     artist        => { data_type => 'integer', is_nullable       => 0 },
     year          => { data_type => 'integer' },
     number_tracks => { data_type => 'integer' },
-    artwork       => { data_type => 'integer' },
+    file       => { data_type => 'integer' },
 );
 
 __PACKAGE__->set_primary_key('id');